jeudi 15 février 2018

How to call a action from each loop while create a new element?

I require to add a class name according to the index. as well I do have much other conditional events to add with each of the element. for that reason I would like to add a call back on element create.

how can i call a function from each iterator. I tried like this:


    <li class="(action 'setting()')"></li> //trying to call


here is my controller:

actions:{
    setting:function(element, index){
        console.log(element, index); // i will add class name by condition
    }
  }

is it possible? or what is the correct way? especially i require to add different css classes according to the index value. ( for idea )

Live Example




Aucun commentaire:

Enregistrer un commentaire