As far as I know about AngularJS, this is one of the interesting libraries out today. I am slowly understanding the Angular power, and I am seriously loving it. I have a few dou
The easiest way is to add all sharable directives and other parts to ng module.
angular
.module("ng")
.directive("myDirective", function() {
...
})
.filter("MyFilter", function() {
...
});
This is the easiest way (a kind of set and forget) as you can easily just drop your directive script to your HTML and forget about it while developing new modules that naturally also require it.
Why is adding shareable stuff to ng module sensible? Because you may have simple pages in your app that don't define a particular ngApp module, but rather just set ng-app
on HTML/BODY and run inline angular directives only.
When you add your directive to ng
module, these pages can also use your directive.
...