mercredi 20 décembre 2017

Selecting Multiple element with condition with toggle approach

In my list, I have more than 5 fruit. user can select max as 5 fruit. once the 5 fruits reach, I would like to show them a alert to say your 5 selection is over.

also, user can deselect the fruit already which they selected, by clicking again ( toggling )

how to achieve this?

Controller:

import Ember from 'ember';

export default Ember.Controller.extend({
  selectedIndex:null,
  appName: 'Ember Twiddle',
   actions:{
    select:function(index){
     console.log('index is', index );
    }
  }
});

here is my try : Live Demo

Any one help me here?




Aucun commentaire:

Enregistrer un commentaire