vendredi 29 mai 2020

Use observer with decorator in EmberJS

I tried to use observers with decorator syntax but it does not seems to work.

Without decorators:

onRouteChange: observer('router.currentRouteName', function () {
  this.closeModal();
}),

Tried this with decorators (fails):

@observer('router.currentRouteName')
handler() {
  this.closeModal();
}

Error message:

Assertion Failed: observer must be provided a function or an observer definition

I may have missed something but I did not found anything about decorators and observers in the documentation.




Aucun commentaire:

Enregistrer un commentaire