Ember.js: OK to avoid this.get ('attr')?

My My Ember.js classes, views, and controllers are getting a bit detailed. Part of this comes from writing this.get('attr')instead this.attr.

Is it possible to simply write this.attrif an attribute is declared directly, and not through a binding?

(I understand that customization is another problem - you always need to call this.set('attr', value)to update dependent attributes and templates.)

+5
source share
3 answers

IIRC, you can do this for private properties that, as you know, will not be observable.

The convention is to prefix your personal properties with an underscore (like _myProperty), which tells Ember not to bind it.

. get() , .

+5

, this.attr. get - , .

+3

Ember. 3.1, 2018 , ES5 . Ember 3.1 this.get('attr') - , unknownProperty, Ember Data PromiseProxyObject , . , . .

0

All Articles