$scope.checkCode=function(LinePoint){
if($scope.pwd){
// 判断旧密码是否正确
if(arrayToString(LinePoint)==$scope.pwd){
$location.url("/setting");
}else{
$ionicLoading.show({
template: '确认手势密码不正确',
duration: 1000
});
}
}else{
$scope.$apply('gestureHint = "请确认手势密码"');
$scope.pwd = arrayToString(LinePoint);
}
}
上面代码里的$location.url()失效了,无法跳转。
在这里http://stackoverflow.com/questions/11784656/angularjs-location-not-changing-the-path看到了解决方法,是之前使用了
apply方法的原因,解决方法是将
locaton.url()放在timeout(function(){location…
},1)内,即可解决。
$scope.checkCode=function(LinePoint){
if($scope.pwd){
// 判断旧密码是否正确
if(arrayToString(LinePoint)==$scope.pwd){
alert($location.url());
$timeout(function(){
$location.url("/setting");
},1)
}else{
$ionicLoading.show({
template: '确认手势密码不正确',
duration: 1000
});
}
}else{
$scope.$apply('gestureHint = "请确认手势密码"');
$scope.pwd = arrayToString(LinePoint);
}
}