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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -