Angular Dynamic Module Dependency

I developed a comment module for Umbraco that uses angular. Thus, the main angular application for the site should implement a module of comment systems for its operation.

eg.

var theirSite = angular.module('someApp', []);

Introduced

var theirSite = angular.module('someApp', ['theCommentSystemModule'];

In my comment system

   angular.module('theCommentSystemModule']....;

Is there a way that my module can automatically detect an angular application and deploy it myself without code to update the site? I want it to work only with a script link.

For example: let's say these are scripts

<script src="...angular.js">
<script src="...services.js">
<script src="...directives.js">
<script src="...commentsPlugin.js">
<script src="...theirApp.Js">

So what I basically need is some kind of callback from angular when the application loads, so I can insert the comment system module into the application as a decentration module so that it initializes in its boot layer.

, , ? , . bootstrap bootstrap.

+4
1

. , , , .

'ng' - ATM ( requires), :

angular.module('ng').requires.push('theCommentSystemModule');

.

+6

Source: https://habr.com/ru/post/1607992/


All Articles