gpt4 book ai didi

angularjs - 我可以在不刷新 View 的情况下重新加载应用程序吗?

转载 作者:行者123 更新时间:2023-12-03 03:41:34 24 4
gpt4 key购买 nike

我在我的应用程序中使用 UI Router,我想知道当用户注销时是否可以重新加载或销毁服务,而不刷新 View ?到目前为止,当用户注销时,后端将其注销,并将其重定向到登录 View 。但是,所有服务仍然有效。有什么想法吗?

谢谢

最佳答案

//Controller where the logout button is called
.controller("ctrl", function(destroyService){

this.logout = function(){
//Probably an ajax request to logout from server.
$http.post("logoutUrl", userId)
.then(function(){
destroyService.destroyAll();
$state.go("loginPage");
});
};

})


.service("destroyService", ["service1", "service2", function(service1, service2){

this.destroyAll = function(){
service1.destroyAll();
service2.destroyAll();
};

}]);

关于angularjs - 我可以在不刷新 View 的情况下重新加载应用程序吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35265152/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com