简体   繁体   中英

How to remove/clear data stored in scope variables on logout in angularjs app?

I have four controllers in my angular app. I am storing data in scope variables in all the controllers. I want to clear/remove data of all the scope variables on logout. On logout, I am declaring login id and password as blank but how to clear data of other scope variables of other controllers? I don't want to use route.reload as it gives bad UX.

Well normally you declare variables somewhere and set them back to null when you leave.

$scope is a normal JavaScript object with key values so it should be possible to

delete $scope.key;
delete $scope.keyTwo;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM