I am using a module called ngStorage for handling local Storage operations.(https://github.com/gsklee/ngStorage). Lets say I set an object in local storage $localStorage.something = true; How do I watch this object to find out if it is still available in local storage? I'v tried :
$scope.$watch($localStorage.something,function(newVal,oldVal){
if(oldVal!==newVal && newVal === undefined){
console.log('It is undefined');
}
});
Basically I am trying to watch for when a user removes the object from local storage manually through chrome's console.Is this even possible??
you can try:
$scope.$watch(function () { return $localStorage.something; },function(newVal,oldVal){
if(oldVal!==newVal && newVal === undefined){
console.log('It is undefined');
}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With