我想要一个复选框'勾选'它的自身取决于值data.notification是真还是假。我可以看到变量在console.log中设置为true,但即使使用data.model / checked它仍然无法正常工作 这是我的控制器
.controller('ConfigCtrl', function($scope, $stateParams,$http,$timeout,$localStorage,StorageService) {
$scope.data = {};
// Declare localStorage Variables to scope variables
$scope.data.claymore_api= window.localStorage.getItem('claymore_api');
$scope.data.cam_api= window.localStorage.getItem('cam_api');
$scope.data.rpi_api= window.localStorage.getItem('rpi_api');
$scope.data.fire_api= window.localStorage.getItem('fire_api');
$scope.data.notification= window.localStorage.getItem('notification');
$scope.data.enable_cam= window.localStorage.getItem('enable_cam');
$scope.data.enable_power= window.localStorage.getItem('enable_power');
$scope.data.enable_fire= window.localStorage.getItem('enable_fire');
$scope.data.casefire= window.localStorage.getItem('casefire');
console.log($scope.data.notification);
$scope.add = function () {
window.localStorage.setItem('claymore_api',$scope.data.claymore_api);
window.localStorage.setItem('cam_api',$scope.data.cam_api);
window.localStorage.setItem('rpi_api',$scope.data.rpi_api);
window.localStorage.setItem('fire_api',$scope.data.fire_api);
};
$scope.settings = function () {
window.localStorage.setItem('notification',$scope.data.notification);
window.localStorage.setItem('enable_cam',$scope.data.enable_cam);
window.localStorage.setItem('enable_power',$scope.data.enable_power);
window.localStorage.setItem('enable_fire',$scope.data.enable_fire);
window.localStorage.setItem('casefire',$scope.data.casefire);
console.log(window.localStorage.getItem('notification'));
};
})

这是html
<li class="item item-toggle">
Notifications
<label class="toggle toggle-positive">
<input type="checkbox" ng-model="data.notification" checked="{{data.notification}}">
<div class="track">
<div class="handle"></div>
</div>
</label>
</li>
&#13;