mardi 29 novembre 2016

Use an if statement to make checking possible

I am a newbie to AngularJS so here is my question. I use the Ionic Framework and AngularJS and I want to use an if statement to check if a task is completed or not. I can do that but I want to use icons as well, an empty checkbox if it's not completed and a checked checkbox.

My code:

<ion-list>
  <ion-item ng-repeat="task in tasks" class="item-icon-right" ng-class="{complete: task.completed}"
            ng-click="task.completed = !task.completed">
    <i class="material-icons">check_box_outline_blank</i>
    <i class="material-icons">check_box</i>
    
    <ion-option-button class="button-assertive delete" ng-click="tasks.splice($index, 1)"><i class="material-icons">delete</i>
    </ion-option-button>
    <ion-option-button class="" ng-click="edit(task)"><i class="material-icons">mode_edit</i></ion-option-button>
  </ion-item>

</ion-list>

Aucun commentaire:

Enregistrer un commentaire