angularjs - Add a script tag to the DOM including Angular code -


i'm developing application momentaneoulsy uses angular, namely directives. @ moment want able through javascript add script tag including directive code.

var s = document.createelement('script');  s.type = 'text/javascript';  s.src = 'path directive file'  $('body').append(s); 

the file loaded never handled angular code. in page:

<my-directive></my-directive> 

is never transformed desired template.

am doing wrong?

there 2 ways bootstrap angularjs app: automatic or manual.

if using ng-app directive in markup, bootstrapping automatically, , attempting won't work, because app initialized @ point.

manually bootstrapping might work in case. recommend read docs on bootstrapping.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -