Angular development and using services into run app

65 views Asked by At

I was wondering if anyone could help me understand why i can't get my code works.

I have put a session check in the run method from my main module, everything for the checking part works well but for some reasons when i try to launch the modal to reconnect the user, i'm getting this error

Uncaught Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- loginModalService. 

I have already check the following reasons:

The loginModalService.js is include as well as the template. I have put run(['$rootScope', '$window', "$location", "loginModalService", function ($rootScope, $location, $window, loginModalService) { i order to prevent minification trouble.

I took the idea of launching the modal into the run method from this website: authentication-made-simple-in-single-page-angularjs-applications

I hope you can help me.

3

There are 3 answers

0
Wiist On BEST ANSWER

everyone after looking more precisely into the error display, i finally get what didn't work on my code.

I didn't came from the run method but from the service that i create. I indeed put a $scope, which is not allowed in service.

5
Pankaj Parkar On

You have missplaced the dependancy

run(['$rootScope', '$window', "$location", "loginModalService",
        function ($rootScope,  $window, $location, loginModalService) {
1
otaviodecampos On

Other possibility is loginModelService service was never registered on your angular app.