ember.js - EmberJS Computed Properties only evaluated if they are used in the template? -


i ran strange issue computed property not executing. after testing realized other computed properties in object working fine , difference working ones rendered/used in template.

i have created jsbin demonstrate. http://jsbin.com/izoyok/16/

both properties have identical code , behavior. difference items1computedproperty used in template. , notice computed property logging messages console expected.

is requirement or optimization of ember spend time evaluating computed properties if renedered in template? or making other mistake.

i understand if did design since argued computed properties should not used way, , use observers assign value instance property, on other hand imagine lot of people not make same assumption , didn't see documentation explaining behavior.

http://emberjs.com/guides/object-model/computed-properties/

it's not template thing. computed properties executed when attempts use them. when template references computed property, ember executes function , caches result. in future uses cache value unless 1 of dependent properties have changed, in case cache invalidated , function executed again.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -