我正在尝试为此脚本设置超时,并在超时到期时显示弹出窗口
$scope.mainloginAlert = function() {
var alertPopup = $ionicPopup.alert({
title: 'Error',
template: '<p align="center">Incorrect Username or Password</p>',
});
};
$scope.mainlogin= function(){
$ionicLoading.show({template: '<p>Please Wait...</p><ion-spinner></ion-spinner>'});
event.preventDefault();
$http.post("http://web.usersite.com/scripts/login.php",
{'username':$scope.username,'pwd':$scope.pwd})
.success(function(data){
console.log(JSON.stringify(data));;
{$ionicLoading.hide();}
if(data==="Incorrect Username or Password"){
$scope.mainloginAlert()
}
else{
if(data != "Incorrect Username or Password"){
localStorage.setItem("username",(data[0].username));
$window.location.href = 'userpage.html';
}
}
}).error(function(error){
console.error(error);
});
}
}])
没有加载器停止旋转超时的Cos。即使没有互联网连接,它也会继续旋转
答案 0 :(得分:0)
你会想要使用angular的包装器:
$scope.mainlogin= function(){
$timeout(hideLoader, 5000)
function hideLoader() {
$ionicLoader.hide()
}
}
答案 1 :(得分:0)
js code:此加载或弹出窗口将显示为2.5秒,这是提示,请替换为您的凭据。我希望它有效
$scope.post = function () {
$ionicLoading.show({
template: 'Posting ...'
});
console.log('Posting ', $scope.load);
$timeout(function () {
$ionicLoading.hide();
$scope.closePost();
}, 340);
};