I've been trying to save the values from
window.localStorage.getItem('job_id.done_tasks')
into a $scope
variable, but I'm encountering difficulties. Can you please review my code?
$scope.done_tasks = {};
$scope.done_tasks = window.localStorage.getItem('job_id.done_tasks');
When I try to alert('$scope.done_tasks');
, it returns undefined
. However, if I use
alert(window.localStorage.getItem('job_id.done_tasks'));
, it displays 16,17
. I am unsure why I am unable to store the values of window.localStorage.getItem('job_id.done_tasks')
in $scope.done_tasks
. Any help with this would be appreciated.