0

enter image description here

I have my app organizad as in the image...I have a dependency problem when i m trying to inject $state in my app.config module as in the second image

enter image description here

i get the following error :

angular.js:38 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.0/$injector/modulerr?p0=app&p1=Error%3A%20%…frontend%2Fassets%2Fbower_components%2Fangular%2Fangular.min.js%3A20%3A449)

can someone tell me if i m wrong in the order of dependencies?

3
  • I have the same problem also if I try to inject $rootScope Commented Mar 13, 2016 at 12:32
  • 2
    Only providers and constants can be injected into configuration blocks. This is to prevent accidental instantiation of services before they have been fully configured. See more docs.angularjs.org/guide/module Commented Mar 13, 2016 at 12:46
  • ok thanks. I m pretty new to angular... Commented Mar 13, 2016 at 13:22

1 Answer 1

1

You have to inject $stateProvider inside your config function, not $state itself.

Sign up to request clarification or add additional context in comments.

8 Comments

if I add $stateProvider then i can not use $state
Yes, and you would never use instance of your service inside config. Use in in angular.module('app').run(function(){...});
so i have to add my interceptor in run?
in this case yes. but you have to do it on Restangular not on RestangularProvider angular.module('app').run(function(Restangular){...});
watching at this example, beletsky.net/2013/11/… I can not push the interceptor in the .config block if I define my factory
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.