Wednesday, 15 September 2010

dependency injection - AngularJS: Inject custom service into module.config function not possible? -



dependency injection - AngularJS: Inject custom service into module.config function not possible? -

i seek inject custom service module config function, error service undefined:

var myapp = angular.module('myapp', []); myapp.config(function($httpprovider, commonconfigservice) { var baseurl = commonconfigservice.getresturl(); });

i utilize within couple of controllers without problem.

can hint me how solve this?

thanks , kind regards

you cannot inject services config acording angular docs ,

configuration blocks - executed during provider registrations , configuration phase. providers , constants can injected configuration blocks. prevent accidental instantiation of services before have been configured.

angularjs dependency-injection

No comments:

Post a Comment