vendredi 24 juillet 2015

AngularJS ng-repeat get the index of the button clicked and used in jquery

I got some code here, what I want to do is when I click the button I change the checkbox value and at the same time change the color of the button. (check=red,uncheck=black for example)

I think it is easier to do it with jquery. My idea is to get the index of which button is clicked. change the value of the checkbox with the same index and the button color.

But I just cannot figure out how to select the button and the checkbox.

<div id="allcolrepeat">
        <div style="width:200px; float:left; margin:5px;" ng-repeat="col in allColumns">
            <input class="colCheckbox" type="checkbox" ng-change="changeCheck(col.displayName)" ng-model="checkvalue[col.displayName]">
            <button>{{col.displayName}}</button>
        </div>
</div>

Any help will be appreciated. Thanks.




Aucun commentaire:

Enregistrer un commentaire