javascript - Angular - Unknown Provider from Provider -
I have a strange issue, that somehow my own provider is not properly injection in my app.
This is my provider:
Angular. Module '1425 App'. Provider 'Odata', [() - & gt; @__bab URL = '' return {setBaseUrl: (value) - & gt; @_base url = get $ return value: ['$ http', '$ q', ($ http, $ q) - & gt; Return {getAll: (Resources) - & gt; Dfd = $ q.defer () $ http.get ("# {@_ baseUrl} / # {resource}"). Success (res) - & gt; console.log Race dfd.resolve () return back dfd.promise}]}] This is my app + config block:
angular.module ( '1425App', [ 'ngCookies',' ngResource ',' ngSanitize ',' ui.router ',' angular loading-time ',' ngAnimate ',' toaster ',' ui.gravatar ',' ngFitText ',' google- map ',' mm.foundation ',' restangular ',' ui.select2 ',' ngTable ',' ngGrid ',' ngCsv ',' ui.date ',' ngDragDrop ',' ui.sortable ']) .config ($ stateProvider, $ urlRouterProvider, $ locationProvider, $ httpProvider, cfpLoadingBarProvider, baseurl, ODataProvider) - & gt; $ HttpProvider.interceptors.push ( 'httpInterceptor') ODataProvider.setBaseUrl (baseurl + '/ OData /') cfpLoadingBarProvider.includeSpinner = false ... I'm getting the following error: < / p>
Uncaught error: [$ injector: modulerr] module failed to make the illustration of 1425App: error: [$ injector: unpr] unknown provider: ODataProvider
Clue to do this, I believe, this is an issue with the injection of the provider in my app. What is missing in any idea?
You can see that you already have config block by pasting a snippet paste Odata Provider has been registered ODataProvider After registering try to set up the Config Block. app out to different config block of registration and registered your provider (register load) After registration before you can only configure those providers that block specific config using it. It is not with static , however you can register them in any order. The above information (which was a bug) is in the form of 1.2. * With angular version, 1.3 you can register providers even after config block.
Comments
Post a Comment