<div ng-repeat="filterSection in filterSections">
<h4>{{ filterSection.title }}</h4>
<div class="checkbox" ng-click="loaderStart()" ng-if="filterSection.control == 'checkbox'" ng-repeat="option in filterSection.options">
<label>
<input type="checkbox" ng-model="searchParameters[filterSection.key][option.key]" value="{{ option.key }}" checked><span></span> {{ option.value }}
</label>
</div>
</div>
我可以通過 $scope.searchParameters
訪問它。當頁面刷新時從LocalStorage恢復表格
我可以存儲它使用 localStorage.setItem('search', JSON.stringify(cleanedParameters));
我可以訪問存儲與 JSON.parse(localStorage.getItem("search"));
但我不知道我怎麼會在頁面刷新恢復。是否有一些我可以使用的指令功能或示例?我無法找到與我的問題類似的東西。
爲什麼這一個不工作? 'localStorage.getItem(「search」)' – Sampath
我可以訪問它。但我不知道如何將它放到範圍中,並在我的屏幕上生成它,因此所有複選框都被「檢查」。我需要把它放在某種循環中... – RaV
是你存儲數據的數組還是什麼類型? – Sampath