Answer the question
In order to leave comments, you need to log in
How can you load directives in an already running application in Angular?
Colleagues, I just can’t figure out how in Angular it is possible to load directives in an already running application (I use yepnope)?
Those. if use:
angular.module('app', []).directive('myDirective',[скипа скушала]
var ngApp=angular.module('app', []);
yepnope({
load: 'ng.js',
complete: function() {
//глобальная функция myDirectiveFn с реализацией директивы загружается из ng.js
ngApp.directive('myDirective', myDirectiveFn);
}
});
Answer the question
In order to leave comments, you need to log in
Well, push it into the directive's factory function, and sort it out there.
In general, a somewhat strange approach. Polyfills do not need to be placed in directives. If the directive should work only under certain conditions, you can simply add a check to the link and if anything, just do nothing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question