Watching local storage using angularjs -
i using module called ngstorage handling local storage operations.(https://github.com/gsklee/ngstorage). lets set object in local storage $localstorage.something = true; how watch object find out if still available in local storage? i'v tried :
$scope.$watch($localstorage.something,function(newval,oldval){ if(oldval!==newval && newval === undefined){ console.log('it undefined'); } });
basically trying watch when user removes object local storage manually through chrome's console.is possible??
you can try:
$scope.$watch(function () { return $localstorage.something; },function(newval,oldval){ if(oldval!==newval && newval === undefined){ console.log('it undefined'); } })
Comments
Post a Comment