sahat / satellizer

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

Error: $injector:modulerr Module Error #974

Open hanzal opened 8 years ago

hanzal commented 8 years ago

/This is the error i get:

https://docs.angularjs.org/error/$injector/modulerr?p0=dashboard&p1=%5B$injector:unpr%5D%20http:%2F%2Ferrors.angularjs.org%2F1.5.8%2F$injector%2Funpr%3Fp0%3Da%0AN%2F%3C@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:6:412%0Acb%2Fn.$injector%3C@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:43:174%0Ad@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:40:432%0Ae@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:41:158%0Ah%2F%3C.invoke@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:41:243%0Ad@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:39:410%0Ag%2F%3C@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:40:19%0Aq@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:7:353%0Ag@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:39:319%0Acb@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:43:336%0ABc%2Fc@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:20:390%0ABc@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:21:179%0Afe@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:20:1%0A@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fangular.min.js:317:386%0Ag%2F%3C%2Fj@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fjquery.min.js:2:29566%0Ag%2F%3C%2Fk%3C@http:%2F%2Flocalhost:5000%2Fbuild%2Fjs%2Fjquery.min.js:2:29882%0A

and my code looks like this.

var app = angular.module('dashboard', ['nvd3', 'ngRoute', 'satellizer']);

       app.config(function($authProvider) {
    $authProvider.facebook({
      clientId: '312681992431130'
    });
    });

    app.controller('DashboardController', ['$scope', '$http', '$log', function($scope, $http, $log) {
        var dashboardApiUri = '/api/dashboard';

        $scope.data = new DashboardData();

        $http.get(dashboardApiUri).then(
            function successCallback(response) {
                $scope.data.init(response.data);
            },
            function errorCallback(errorResponse) {
                $log.error(errorResponse);
            }
        );

        $scope.link = function(provider) {
            $log.debug("Profile Got");
            $auth.link(provider)
                .then(function() {
                    $scope.getProfile();
                    $log.debug("Profile Got");
                })
                .catch(function(response) {
                    $log.debug("Profile Error");

                });

I have ngRoute installed. Please can you figure it out. I have imported satellizer before impoerting this file.

hanzal commented 8 years ago

Got it right after changed the app.config(function($authProvider) {

to app.config(["$authProvider",function($authProvider) {

please correct it in the examples you can read more in here : Dependency Injection

but still i cant get the link function running. it is not responding.

hanzal commented 8 years ago

Its giving a error: ReferenceError: $auth is not defined

i tried installing ng-token-auth but it still gives an error Please help me here