我想刷新一个URL而无需刷新页面即可成功登录。 我正在使用以下代码如何用新的url替换url而不用页面刷新角js
$scope.Login = function (teacher, chkRememberMe) {
alert(chkRememberMe);
$http.post("/Teacher/Login", { teacher: teacher, chkRememberMe: chkRememberMe })
.success(function (result) {
if (result == "True") {
toastr.success("You are Login successfully!!!");
$timeout(function() { }, 5000);
$timeout(function() { }, 5000);
$location.path('Teacher/Index');
}
else {
toastr.error("The email and password you entered don't match.")
window.location = "/Teacher/Login";
}
})
.error(function (error) {
error.message
alert(error);
toastr.error("The email and password you entered don't match11")
})
}
URL未成功更新。
修正措辞和拼写错误。 – Prune
我相信你想要的是ngRoute这里记录:https://docs.angularjs.org/api/ngRoute/service/$route –