menu
Logo
  • Why azing?
  • Blog
  • Help
ENarrow_drop_down
  • DE
  • EN
Suche in Checklisten
search
azing Logo ENarrow_drop_down
  • DE
  • EN
  • Why azing?
  • Help
2sxc
drive_folder_upload
  • homeChecklist Templates
  • south
  • fiber_manual_recordPro: Develop with 2sxc (Apps, Content-Types, Templates, etc.)
  • south
  • fiber_manual_recordJS: Angular Apps Development
  • south
  • fiber_manual_recordDnn-Sxc-Angular 11 (for Angular 6-11)
  • south

folder_sharedDnn-Sxc-Angular 11 (for Angular 6-11)

  • homeChecklist Templates
  • south
  • fiber_manual_recordPro: Develop with 2sxc (Apps, Content-Types, Templates, etc.)
  • south
  • fiber_manual_recordJS: Angular Apps Development
  • south
  • fiber_manual_recordDnn-Sxc-Angular 11 (for Angular 6-11)
  • south

folder_sharedDnn-Sxc-Angular 11 (for Angular 6-11)

Folders and checklists

  • folder_sharedToolbars
  • check_circlednn-sxc-angular - Quick Start
  • check_circlednn-sxc-angular - Tutorial - Accessing Content using REST and content$
  • check_circleEnable local development in an existing 2sxc / DNN / Angular 11 app
  • check_circleTemplate Angular 11 App - Getting started
  • check_circleTemplate Angular 11 App - Install and Discover
  • check_circleTemplate Angular 11 App - Rename the App

Parts (0) expand_more

These are small document-parts which are used in other documents. They are not a starting point for any real activity. Because of this, they will be listed further down and the search will not list them unless requested. 

Install dnn-sxc-angular

  1. Run npm install "@2sic.com/dnn-sxc-angular" --save to add the dnn-sxc-angular connector

Make App Aware of DNN

We must ensure that the HttpClient uses DNN headers when making requests. This is handled by dnn-sxc-angular, but for this it must be initialized, which requires changes to the app.module.ts and the app.component.ts in /src/app.

Setup app.module.ts

Open app.module.ts and add HttpClientModule to the imports and DnnInterceptor to providers. At the top, add these imports and add the DnnInterceptor to the providers:

// ... imports you already had
import { HttpClientModule } from '@angular/common/http';
import { DnnInterceptor } from '@2sic.com/dnn-sxc-angular';
// ... more imports

@NgModule({
// ...existing stuff
imports: [
// ... your stuff
HttpClientModule,
]
providers: [ DnnInterceptor ],
// ...more stuff
})
// ... more stuff

You can find an example of this in the app.module.ts of the demo app.

Change app.component.ts to Link into DNN

The app.component.ts must basically have the following changes

  1. inherit from DnnAppComponent
  2. get the ElementRef and the current Context
  3. execute the constructor of DnnAppComponent so that dnn-sxc-angular can auto-configure itself.

This look approx like this (see also the app.component.ts on the demo app):

import { Component, ElementRef } from '@angular/core';
import { DnnAppComponent, Context } from '@2sic.com/dnn-sxc-angular';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent extends DnnAppComponent {
constructor(
el: ElementRef,
context: Context
) {
super(el, context);
}
title = 'my-app';
}

You are now set, running the app in DNN ensures that the HttpClient is reconfigured automatically.

Logo
Legal | Content Copyright CC-BY 4.0
bug_reportReport Bug
  • info
  • Links
  • Permissions
code Share
code
URL copied to clipboard.
Embed Checklist close
Copy Copy
Content Copyright

CC-BY 4.0

Translations

None

2sxc - Content Management for DNN & Oqtane Logo

2sxc - Content Management for DNN & Oqtane

QR-Code
azing.org/2sxc/r/AGhgYOAI
View & Use

Public (can be used by everybody)

Edit & Admin

Default (all members can edit)

This catalog has a simple permission model, where all members have the same permissions. For advanced permissions, upgrade to Enterprise.

Here you can see how this document is used and linked by other documents

Used in (1)

Others referencing this

  1. dnn-sxc-angular - Quick Start
Uses these (0)

Documents linked from this document

How it Behaves

How this document is categorized changes how it behaves.

This is a partial document. It is listed below the normal documents, and is hidden in the default search.

It belongs to dnn-sxc-angular - Quick Start

Type

This is a Checklist. Lists are converted into checkboxes.

Get something to say?

Comment to start a discussion or make a note
send

please log on to chat

close

Durchsuche ganz Azing