<div ng-repeat="section in filterSections">
<h4>{{ section.title }}</h4>
<div class="checkbox" ng-click="loaderStart()" ng-if="section.control == 'checkbox'" ng-repeat="option in section.options">
<label>
<input type="checkbox" ng-model="searchParams[section.key][option.key]" value="{{ option.key }}" checked><span></span> {{ option.value }}
</label>
</div>
</div>
I am able to access it by using
$scope.searchParameters
.
To save it, I can use
localStorage.setItem('search', JSON.stringify(cleanedParams));
To retrieve the saved data, I can use
JSON.parse(localStorage.getItem("search"));
One challenge I face is how to restore this data when the page is refreshed. Are there any specific functions or directives that could help with this? I have searched extensively but haven't found a solution tailored to my issue.