Helper#recompute()

recomputepublic

Defined in packages/ember-htmlbars/lib/helper.js:66
Available since 1.13.0

On a class-based helper, it may be useful to force a recomputation of that helpers value. This is akin to rerender on a component.

For example, this component will rerender when the currentUser on a session service changes:

// app/helpers/current-user-email.js
export default Ember.Helper.extend({
  session: Ember.inject.service(),
  onNewUser: Ember.observer('session.currentUser', function() {
    this.recompute();
  }),
  compute() {
    return this.get('session.currentUser.email');
  }
});
doc_EmberJs
2016-11-30 16:52:12
Comments
Leave a Comment

Please login to continue.