我想刷新一個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 –