vendredi 6 mai 2016

Ember JS property accessor

I saw that given an Ember model Book:

export default Model.extend({
  title: attr('string'),
});

One can access the book's title property doing: book.get('title');.

This notation seems complicated and error-prone (no IDE support). Why do properties can't be accessed like:

  • book.title
  • or even book.title() ?

Is there a technical reason to do that, or it is just "the good way" to do it in JS ?

I hope the question is not stupid, I'm pretty new to those JS frameworks.

Thanks.




Aucun commentaire:

Enregistrer un commentaire