vendredi 28 février 2020

check uncheck checkbox using angularjs using attribute

I want to add checked and unchecked attribute to the checkbox which is in a table I tried to using it via jquery in angularjs

$('#chksitecolumn_' + item.Id).attr('checked', true)

Here item.Id is the id which I am iterating and binding it on ng-model.

and also tried it using angularjs

 var element = angular.element('#chksitecolumn_' + item.Id);
                            element.attr('checked', 'checked');

but it is not working

Here is my checkbox

<input  type="checkbox" class="test"  id="chksitecolumn_" ng-model="selected[item.Id]"/>

I am passing an ID as a key using ng-model I want to know that can we check uncheck checkbox except using ng-model?




Aucun commentaire:

Enregistrer un commentaire