jeudi 13 juillet 2017

Ember setting a property from a reopened method

I have used .reopen in my file to do a few changes to a class, but I'm struggling to change a computed property in the same file.

I'll start with a simple property

export default Ember.Component.extend({
    ...
    outputRange: "test",
    ...
});

powerCalendarRange.reopen({
    actions: {
        select(day, calendar, e) {
          let range = this._buildRange(day);
          let { start, end } = range.moment;
          this.set('outputRange', "set");
          if (start && end) {
            let { minRange, maxRange } = this.get('publicAPI');
            let diff = Math.abs(end.diff(start));
            if (diff < minRange.as('ms') || maxRange && diff > maxRange.as('ms')) {
              return;
            }
          }
          let action = this.get('onSelect');
          if (action) {
            action(range, calendar, e);
          }
        }
    }
});

then of course, I'd like to show outputRange in an html element like so:

<input type="text" value="" />

I know I'm doing something wrong, and I think it has to do with this. What should I be looking into?




Aucun commentaire:

Enregistrer un commentaire