使用具有离子的卫星获得错误

时间:2016-03-02 13:10:25

标签: ionic-framework satellizer

.controller('LoginCtrl',function($ scope,$ location,$ stateParams,$ ionicHistory,$ http,$ state,$ auth,$ rootScope){

    $scope.loginForm = {}
    $scope.loginError = false;
    $scope.loginErrorText;

    $scope.login = function() {

        var credentials = {
            email: $scope.loginForm.email,
            password: $scope.loginForm.password
        }

        console.log(credentials);

        $auth.login(credentials).then(function() {

            $http.get('http://localhost:8000/api/authenticate/user').success(function(response){

                var user = JSON.stringify(response.user);


                localStorage.setItem('user', user);


                $rootScope.currentUser = response.user;


                $ionicHistory.nextViewOptions({
                  disableBack: true
                });

                $state.go('app.jokes');
            })
            .error(function(){
                $scope.loginError = true;
                $scope.loginErrorText = error.data.error;
                console.log($scope.loginErrorText);
            })
        });
    }

}); 我收到此错误 错误:[$ injector:unpr]未知提供商:$ authProvider< - $ auth< - LoginCtrl 当我在函数中添加$ auth时。

0 个答案:

没有答案