0

当我尝试将页面重定向到 index.html 时,我收到以下错误:$location 未定义。当用户和密码正确时,我只需要重定向到索引页面。

 app.controller('loginController', ['$scope', '$kinvey',  function($scope, $kinvey, $location) {


     $scope.login = function() {

          var promise = $kinvey.User.login({
                username : $scope.username, 
                password : $scope.password
            });

            promise.then(function(response) {
              console.log('User in');
              $location.path('/index.html');

            }, function(err) {
               console.log(err);
            });  
      }

  }
 ]);
4

1 回答 1

0

您忘记在参数中添加 $location :

app.controller('loginController', ['$scope', '$kinvey','$location'/*here*/,  function($scope, $kinvey, $location) 
于 2015-11-15T03:30:13.310 回答