view raw
Narek Mamikonyan Narek Mamikonyan - 6 months ago 48
AngularJS Question

Use Angular constant outside of angular

I know it is not a good practice to use Angular services outside of angular but nevertheless it's very interesting for me, for example I have


how can I retrieve APIprefix value outside of angular scope? For instance from other js file which is not in angular scope.


You can access any service like this:


Note that you should pass to angular.element DOM node where you put ng-app. In the example above document.documentElement is HTML tag.