I store some data in the localStorage
what I want in my angularjs app is that when the data in the localStorage changed, the app rerender the app, how can I do this?
$scope.$on("LocalStorageModule.notification.setitem", function (key, newVal, type) {
console.log("LocalStorageModule.notification.setitem", key, newVal, type);
});
$scope.$on("LocalStorageModule.notification.removeitem", function (key, type) {
console.log("LocalStorageModule.notification.removeitem", key, type);
});
$scope.$on("LocalStorageModule.notification.warning", function (warning) {
console.log("LocalStorageModule.notification.warning", warning);
});
$scope.$on("LocalStorageModule.notification.error", function (errorMessage) {
console.log("LocalStorageModule.notification.error", errorMessage);
});
this event calling when using https://github.com/grevory/angular-local-storage#getstoragetype
in app config
myApp.config(function (localStorageServiceProvider) {
localStorageServiceProvider
.setPrefix('myApp')
.setStorageType('sessionStorage')
.setNotify(true, true)
});