sahat / satellizer

Token-based AngularJS Authentication
https://satellizer-sahat.rhcloud.com
MIT License
7.86k stars 1.13k forks source link

Error: [$injector:modulerr] Failed to instantiate module satellizer - Satellizer 0.15.5 and Angularjs 1.5.11 #1089

Open KawtharE opened 7 years ago

KawtharE commented 7 years ago

Hello, I working on web application with Laravel on back-end and AngularJS for the front-end. Now to implement my Laravel REST api for login in the front-end i am using Satellizer 0.15.5. I have followed the instruction to integrate it into my project: -Installed using bower --save -Add the script to my master page <script src="AngularApp/bower_components/satellizer/dist/satellizer.js"></script> -In app.js `angular.module('myApp', ['satellizer', ...]) .config(function($stateProvider, $urlRouterProvider, $authProvider) {

                // Satellizer configuration that specifies which API
                // route the JWT should be retrieved from
                $authProvider.loginUrl = '/api/authenticate';

                // Redirect to the auth state if any other states
                // are requested other than users
                $urlRouterProvider.otherwise('auth');

                $stateProvider
                    .state('auth', {
                        url: '/auth',
                        templateUrl: '../auth.html',
                        controller: 'AuthController as auth'
                    })
                    .state('dashboard', {
                        url: '/dashboard',
                        templateUrl: 'pages/dashboard/dashboard.html'
                    });
            });`

Now in the browser i got two kind of errors: 1-Uncaught ReferenceError: angular is not defined at ng1.ts:13 at satellizer.js:10 at satellizer.js:11

2-Error: [$injector:modulerr] Failed to instantiate module satellizer due to: Error: [$injector:nomod] Module 'satellizer' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

Please i need some help here, any one have any idea this is the first time i use Satellizer and Thanks

KawtharE commented 7 years ago

Ok, i have solved the first problem. i was just have to put: <script src="AngularApp/bower_components/angular/angular.js"></script> before <script src="AngularApp/bower_components/satellizer/dist/satellizer.js"></script> because Satellizer depends angular so angular have to be loaded first.

Now, i am still stuck in the second problem, i really need some help here, can any one? an thanks

aliasav commented 7 years ago

Please post a question on Stackoverflow with relevant details of app.js settings and your imports in your index.html. Check the examples directory for implementation specific doubts. The error you're getting is a pretty standard error relating to imports, might have nothing to do with Satellizer itself.