How to add a snapshot to the last item in ngRepeat Check-Boxex using Angular js?

I am using the Check-box model as shown here http://vitalets.imtqy.com/checklist-model/ for checkboxes with Angularjs. Some of the Check-boxes need the last check-box element to uncheck all the others. How to add the ngClick attribute to the last element in a set of flags using the check-box-model module.

+3
source share
2 answers

Try below:

 <label ng-repeat="role in roles">
    <input ng-click="$last&&mytest()" type="checkbox" checklist-model="user.roles" checklist-value="role.id"> {{role.text}}
  </label>

Click on the last “admin” flag and this will be a warning window

+1
source

Well, I know little about the control model, but you can add ngClick to the last element, like this:

<label ng-click={{$last && yourFunction || ''}} ng-repeat="role in roles">
  <input type="checkbox" checklist-model="user.roles" checklist-value="role"> {{role}}
</label>

, ng-click , . .

+1

All Articles