mercredi 4 février 2015

ng-switchery doesn't update on $http callback

I've got a checkbox using ng-switchery which looks like this



<input type="checkbox" class="pull-right js-switch" ui-switch="{color:'#1AB394'}" ng-model="activeSwitch"/>


In my the controller that handles this I'm fetching some data using $http :



$http.get('/clients/' + $stateParams.id)
.success(function (client) {
$scope.client = client;
$scope.activeSwitch = $scope.client.active;
});


I would expect the callback to successfully set the state of my checkbox aswell, but it doesn't. I have tried calling $scope.$apply() but that didn't really change anything, neither did adding an ng-checked directive on the checkbox





Aucun commentaire:

Enregistrer un commentaire