In angularjs , i have a logout button. To clear the session storage im using window.sessionStorage.clear(). But I want to clear session storage using service. The service im using is LocalCacheService .How to clear sessionStorage using this service
'controller': ["$scope","LocalCacheService", function ($scope,LocalCacheService) {
console.log("Logout Controller called....");
$scope.Logout = {
}
}]
In that logout what should i add to clear session storage using service
You are able to clear all data stored within sessionStorage if required.
In order to clear everything stored by your application within sessionStorage you should use the following:
$sessionStorage.empty();
See the link http://ghost.scriptwerx.io/angularjs-sessionstorage/