I like to explain my problem clearly
I have a list of checkbox displayed using ng-repeat, now i need to disable some checkbox based on specific value checkbox is checked.
checkbox display code
<div class="checkbox">
<label ng-repeat="specific in specifications">
<input ng-click="onClick(specific, newObject[specific])" id="specifications_chk" value="" ng-model="newObject[specific]" type="checkbox">
</label>
</div>
Here am using ng-click function to disable checkbox.
This is my controller code:
$scope.onClick = function(sp, checked){
if(sp == 'Sofa_Cleaning' && checked === true){
angular.element(document.getElementById('specifications_chk'))[0].disabled = true;
}
if(sp == 'Sofa_Cleaning' && checked === false){
angular.element(document.getElementById('specifications_chk'))[0].disabled = false;
}
};
html view:
in controller code am able disable only first value (IndepthHomeCleaning)
, so how can i disable Room_Cleaning, Kitchen_Cleaning,
and Carpet_cleaning
when Sofa_Cleaning
is checked
Am i stuck with this, Help will be really appreciated
Aucun commentaire:
Enregistrer un commentaire