繁体   English   中英

登录后重定向页面-AngularJS和Kinvey

[英]Redirect page after signIn - Angularjs and Kinvey

当我尝试将页面重定向到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);
            });  
      }

  }
 ]);

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

app.controller('loginController', ['$scope', '$kinvey','$location'/*here*/,  function($scope, $kinvey, $location) 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM