Developing Angular with ng serve is magic, as you see the results in real-time while coding. But doing this with an app which uses endpoints on DNN is almost impossible. But not any more, the rebellion has found a cool solution...
What is dnn-sxc-angular
This is an npm component which you can add to your angular applications. It automatically...
- looks at the page and detects things like tab-id, module id and the security token
- changes all http-requests to DNN to have the necessary headers
To install it, use this azing recipe. And you can also look at it on git and npm.
Local Development in Version 6
Previously you always had to build the app and run it in DNN to see if it works. This needs a lot of time compared to just running it localling using ng serve. In Version 6 we added
- a complete infrastructure to give dnn-sxc-angular initialization values (since it can't auto-detect them when not running in DNN)
- changed 2sxc in 9.43 to have a new feature, which fixes many known CORS problems (because otherwise the cross-domain requests from localhost will usually be refused).
To set this up, there is also an azing recipe.
Love from Switzerland,
Daniel and Raphael