samedi 5 décembre 2015

Return currently checked item in table

Hei guys, i'm trying to return the current checked item in a table like this:

  currentChecked: computed('model.@each.checked', function() {
    let current;
    let checkeds = this.get('model').filterBy('checked');

    if (checkeds.length === 1) {
      return checkeds.get('firstObject');
    }
  }),

But is not working at all.

In each item in my model i have a checked property, and i'm assigning this property to a checkbox input.

I want be able to use this currentChecked in a link-to:

{{#link-to "events.edit" currentChecked}}Edit{{/link-to}}

Thanks.




Aucun commentaire:

Enregistrer un commentaire