I am trying to set values in localStorage. After the function call I am trying to change that value. please check my code
this is my angular js function
localStorage.setItem("popupstatus", true);
$scope.loadInitialPopUp = function (){
if ( localStorage.getItem("popupstatus") === true){ //only show if they haven't seen it.
$scope.openPopup();
}
}
$scope.openPopup = function () {
var modalInstance = $uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
controller: 'popupPeriodCtrl',
scope: $scope,
resolve: {
},
templateUrl: 'modules/popup-period/popup-period.html'
});
localStorage.setItem("popupstatus", false);
};
I am calling above function in my Html page
<div ng-init="loadInitialPopUp()"> </div>
I need to load this pop up, from the values set in localStorage. How do I do it?