【发布时间】:2016-03-05 00:58:10
【问题描述】:
我在模式中创建了一个复选框: 但是当我关闭并重新打开模式时,已检查的项目不会显示为已检查。这是我的代码
<div class="list">
<ion-checkbox ng-repeat="thema in themen track by $index"
type="checkbox"
id="{{thema.id}}"
ng-model="thema.checked"
ng-checked="{{getCheck($index)}}">
{{ thema.name }}
</ion-checkbox>
</div>
在我添加的js文件中
$scope.openModal = function() {
$scope.modal.show();
$scope.themen = [
{ name: 'something', id: 1 },
//some other objects
];
};
$scope.closeModal = function() {
$scope.updateThemaLocalStorage = function ($index) {
$window.localStorage.setItem( $index, $scope.themen[$index].checked );
};
$scope.modal.hide();
};
也在gulp watch 我收到error "$index" is defined but never used no-unused-vars
【问题讨论】:
标签: angularjs checkbox ionic local-storage