我有這個複選框。保持複選框的狀態angularjs
<div ng-repeat="setting in settings">
<input type="checkbox" name="setting.name" ng-model="setting.value">{{setting.name}}
,並在控制器
$scope.settings = [{
name: 'OrderNr',
value: ''
}, {
name: 'CustomerNr',
value: ''
}, {
name: 'CatalogName',
value: ''
}, {
name: 'OrderDate',
value: ''
}, {
name: 'OrderState',
value: ''
}];
當我點擊保存按鈕,我在本地存儲
$scope.saveSetting = function() {
var json = angular.toJson($scope.settings);
localStorageService.add('settings',json);
};
我怎能調用該函數用於存儲數據我的設置,當我重新加載頁面?