我试图从一个活动转移到另一个使用离子。 我没有任何错误,但行动不起作用。重定向离子
我的状态是:
的.config(函数($ stateProvider){$ stateProvider .STATE( '指数',{ templateUrl: '的index.html', 网址: '/' }) .STATE( '家',{ templateUrl: '模板/ welcome.html', URL: '/家' });} )
我的控制器:
.controller('HomeCtrl', function($scope, $state, $http, $location) {
$scope.login = function(user) {
$http.get("http://localhost/app_dev.php/json/login/"+user.username+"/"+user.password)
.then(function(response){
console.log(response.data.status);
if(response.data.status === 200)
{
alert("redirect to main page");
$location.path("/home");
}else if(response.data.status === 403){
alert("Login or password incorrect");
}else{
alert("User not found");
}
});
};
})
当我receve我的JSON,我没有错误,但重定向不显示
你使用的是UI路由器吗? –