my code app.js:
jt.controller('TheorieCtrl', function($scope, $window, $ionicPlatform) {
// .log($window.localStorage);
// Ready functions
if ($window.localStorage.getItem('themen') === null) {
$scope.themen = [{
name: "Setting1",
checked: false
}, {
name: "Setting2",
checked: false
}
];
} else {
$scope.themen = JSON.parse($window.localStorage['themen']);
};
$scope.updateThemaLocalStorage = function(items) {
$window.localStorage['themen'] = JSON.stringify(items);
};
});
my html code:
<ion-list>
<ion-checkbox ng-repeat="thema in themen track by $index" class="checkbox-positive item-checkbox-right" type="checkbox" id="" ng-model="thema.checked" ng-change="updateThemaLocalStorage(themen)">
</ion-checkbox>
</ion-list>
In a other controller I would like to determine if Setting1 is checked. Is it something like: if($scope.thema.Setting1.checked){ "do something" } But this doesn't work. I just need help with syntax for this.
I guess this is a absolutely newbie question. sorry for that, I did really searched and tried a lot.
Aucun commentaire:
Enregistrer un commentaire