One Time Binding
TIL that angular 1.3 and onwards has a one-time-bind option to pass to interpolated expressions, which tells angular that the data is not expected to change.
The one-time-bind option tells angular not to add a watcher to the interpolated property, effectively disabling 2-way binding for the property. If you know a $scope
property is not expected to change during the lifetime of the view, why waste the extra time during the $digest()
cycle to dirty-check the property?
Example:
The double semicolon ::
lets angular know that it should do a one time binding of the scope property to the template. If $scope.name
changes in the second situation above, the change will not be reflected in the template.
Another reason to upgrade to angular 1.3!
Comments