angularjs - Angular one-time bindings for object properties -


i want make performance optimization of app. , came across following issue. let me have object multiple keys (which not changeable within 1 object) , view similar this:

<div ng-if="vm.model">     <span>{{ vm.model.property1 }}</span>     <span>{{ vm.model.property2 }}</span>     <span>{{ vm.model.property3 }}</span> </div> 

i have wanted use one-time bindings properties, if change vm.model inside controller object reference, expressions won't updated inside view, unless explicit change of model falsy value , trigger digest cycle somehow, force whole block removed , recompiled.

is there way can avoid having these 3 redundant watchers, since these properties shouldn't watched, parent object reference should.

https://docs.angularjs.org/guide/expression

try this

<div ng-if="vm.model">     <span>{{ ::vm.model.property1 }}</span>     <span>{{ ::vm.model.property2 }}</span>     <span>{{ ::vm.model.property3 }}</span> </div> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -