mardi 27 mars 2018

How to handle ember checkbox binding

I am new with ember and I have a question about checkbox binding.

Here is my js && hbs :

 CompletedToday(id){
          var today = new Date().toISOString().slice(0, 10);
           this.get('DS').findRecord('menu',id).then((recs) => {
              recs.get('completedDates').pushObject(today);
              recs.save();
            });
      },







Menu is a model has a attribute called Completed date, which is a array contains a list of dates(YYYY-MM-DD), there should be a constructor function to check if it’s completed TODAY, if it is completed, make the checkbox of that menu as checked. If not, user can check the specific checkbox I don’t know how to handle this actually, do i need to create another attribute for menu?

Any suggestion would be appreciated




Aucun commentaire:

Enregistrer un commentaire