【发布时间】:2016-04-26 17:24:51
【问题描述】:
<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.setItem('search', JSON.stringify(cleanedParameters));
我可以访问商店
JSON.parse(localStorage.getItem("search"));
但我不知道如何在页面刷新时恢复它。是否有一些我可以使用的功能或指令示例?我真的找不到与我的问题类似的东西。
【问题讨论】:
-
为什么这个不起作用?
localStorage.getItem("search") -
我可以访问它。但我不知道如何将其放入范围并在我的屏幕上生成它,因此所有复选框都被“选中”。我需要把它放在某种循环中......
-
你存储的是数组还是什么类型的数据?
-
键:搜索值:来自 Chrome 资源的 ["43","47"]。
-
那些是被选中的盒子的ID。
标签: javascript angularjs angularjs-scope angularjs-ng-repeat