[英]How to prevent page reload or refresh in AngularJS
$http.get("check_login.php")
.success(function(response) {
if(response.login == 1 || response.login == 2) {
window.location.href = 'new.html';
event.preventDefault();
}
if(response.login == 0 || response.login == undefined) {
window.location.href = 'index.html';
event.preventDefault();
}
});
I think you should learn about routing
in AngularJs
, please go through these links. 我认为您应该了解
AngularJs
routing
,请通过以下链接进行操作。
http://www.w3schools.com/angular/angular_routing.asp http://www.w3schools.com/angular/angular_routing.asp
https://scotch.io/tutorials/single-page-apps-with-angularjs-routing-and-templating https://scotch.io/tutorials/single-page-apps-with-angularjs-routing-and-templating
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.