dnn-sxc-angular - Connecting Angular to DNN and/or 2sxc
Connector for Angular 6 / 7) for developers who use...
- ...the open source platform DNN 7+ (git | web)
- ...and/or the open source CMS 2sxc 7+ (git | web)
This is a helper which
- automatically provides all dnn-parameters (module ID, security token, etc.) to Angular
- adds an Http Interceptor for the HttpClient which automatically applies these parameters to all requests
- prevents the enter-key from causing DNN form submits (optional, you can override this)
It uses observables to make it happen, thereby avoiding timing / async problems common in this scenario.
Setup
It's published on npm, so the most common way is to get it using npm with
npm install "@2sic.com/dnn-sxc-angular" --save
.
- Follow the quickstart guide to start using dnn-sxc-angular.
- To develop locally using
ng serve
follow these instructions
Access DNN or 2sxc WebAPIs
This works automatically, because all headers etc. are automatically added by dnn-sxc-angular.
Using 2sxc Content-Items, Queries and APIs
This package contains a Data
object, which provides 3 observable streams
To use them, best check out the demo app or simply work through TypeScript intelisense - we documented all the commands.
Get ModuleId, TabId, etc. and the sxc
Instance
There is a Context
object which provides these properties as streams (observables). Just inject Context
and access it from there. Note that you almost never need this, as the HttpClient is already configured and ready to go, including the headers it needs.
Internal Notes
Todo
- enhance the content-manager to provide write commands (ATM read-only)