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.
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
Post a Comment