vendredi 29 juillet 2016

angular ng-disable checkbox not update with dynamic source

I have several checkboxes dynamicaly generated from array source:

        /*js*/
        $scope.arrondissements =   JSON.parse('
    [{"name":"4e","checked":false,"disable":true},  
    {"name":"5e","checked":false,"disable":false},  
    {"name":"11e","checked":false,"disable":false},  
    {"name":"12e","checked":false,"disable":false},  
    {"name":"13e","checked":false,"disable":false},  
    {"name":"14e","checked":false,"disable":false},  
    {"name":"15e","checked":false,"disable":false},  
    {"name":"16e","checked":false,"disable":false},  
    {"name":"17e","checked":false,"disable":false},  
    {"name":"18e","checked":false,"disable":false},  
    {"name":"19e","checked":false,"disable":false},  
    {"name":"20e","checked":false,"disable":false}]');


        <!-- HTML -->
        <div ng-repeat="item  in arrondissements" class="checkbox-inline ">
             <label>
             <input type="checkbox" ng-disabled=""
                      value="" ng-model="item.checked" >
              <span></span>
             </label>
        </div>

Checkboxes are generated correctly but When source gets updated , checkbox doesn't update

/*js*/
$scope.disableCb = function () {
      $scope.arrondissements[5].disable = true;
      $scope.arrondissements[6].disable = true;
      $scope.arrondissements[7].disable = true;
}

<!-- HTML -->
<button ng-click="disableCb()">disable</button>  

Could you tell me why and how to fix it?

I made a Plunker : http://ift.tt/2a4kq8Z




Aucun commentaire:

Enregistrer un commentaire