mardi 23 août 2016

angularjs checkbox not ckecked at start

I have a problem to make an angularjs checkbox checked.

the basket[0].Partdelivery come frome db with 1 update() make a post to the db

<label class="checkbox-inline">
    <input type="checkbox" id="inlineCheckbox1"  class="checkbox" ng-model="basket[0].PartDelivery" ng-true-value="1" ng-false-value="0" ng-change="update()">
    
 </label>



<label class="checkbox-inline">
    <input type="checkbox" id="inlineCheckbox1"  class="checkbox" ng-model="1" ng-true-value="1" ng-false-value="0" ng-change="update()">
    1
 </label>

And I also tested this:

In the html:

<div ng-controller="basketController as bc" ng-init="basket={basket}; deliveryaddress={deliveryaddress}; getcheckboxes(basket[0].PartDelivery)">


<input type="checkbox" id="inlineCheckbox1"  class="checkbox" ng-model="partDeliveryCheck.value" ng-true-value="1" ng-false-value="0" ng-change="update()">

in the controller:

$scope.getcheckboxes = function(PartDelivery){
    $scope.partDeliveryCheck={value: PartDelivery};
};

but the checkbox is not checked...

thanks for help




Aucun commentaire:

Enregistrer un commentaire