【发布时间】:2018-02-20 01:06:43
【问题描述】:
首先,所有复选框都被选中。 然后我只检查其中的 2 个并按搜索。
复选框和搜索按钮:
<input type="checkbox" id="stat2" ng-true-value="true" ng-false-value="false" ng-model="ts.status.check2" />
<label for="stat2">Status 2</label>
<br />
<input type="checkbox" id="stat3" ng-true-value="true" ng-false-value="false" ng-model="ts.status.check3" />
<label for="stat3">Status 3</label>
<br/>
<input type="checkbox" id="stat1" ng-true-value="true" ng-false-value="false" ng-model="ts.status.check1" />
<label for="stat1">Status 1</label>
<br />
<input type="checkbox" id="stat4" ng-true-value="true" ng-false-value="false" ng-model="ts.status.check4" />
<label for="stat4">Status 4</label>
<br />
然后一个新页面(新 URL)正在加载,在这个页面上有一个“返回”按钮。 当我按下后退按钮时,我回到了第一页,并且再次选中了所有 4 个复选框,我怎样才能使它成为可能,只有那些被选中,我首先检查了?
返回按钮
<div class="btn-group container panel-footer">
<button type="button" onClick="history.go(-1);return true;" class="btn">Back</button>
</div>
【问题讨论】:
-
在 $rootScope 中存储复选框
-
@ShubhamKandiyal 没有被弃用?对我来说,您应该更喜欢路由参数(UI 路由器或本机路由器)
-
$rootScope 或 localStorage 用于持久化。