javascript - ngStorage not storing data when being updated -


i building directive handles out courses, part of saving course data in local storage user can resume.

when data changes call function

function setlocalstorage(){     if(!preview){         $localstorage.scorm = scope.scorm     } } 

i call when first load course

my problem data not updated in local storage.

when debug can see $localstorage.scorm getting updated in chrome console data in actual local storage unchanged.

solved using $apply

function setlocalstorage(){     if(!preview){         scope.$apply(function () {             $localstorage.scorm = scope.scorm;         });     } } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -