javascript - Angular modules and dependency injection -


let's say: use module called constants.

angular.module("constants", []) .constant("a", 10); 

i want use constant a in module:

angular.module("modulethatuseconstants", ["constants"]) .service("b", ["a", services.b]); // here use 

that works ! if have constant (or controller etc) called a ?

angular.module("modulethatuseconstants", ["constants"]) .service("a", [services.a]);  .service("b", ["a", services.b]); // ??? 

question: how specify a comes module constants ? tried:

.service("b", ["constants.a", services.b]);  

but doesn't work $injector:unpr unknown provider "constants.a"

you cannot achieve this. later 1 same name resolved. 1 of shortcomings of di in angular 1.x. expect see solution in angular 2 di.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -