javascript - Is it correct that one-time-binding re-evaluates variable when combined with ngIf directive? - AngularJS -


one of mates in work show me weird behavior of one-time binding in angular.

usecase:

when have element text binding one-time binding inside block conditional ng-if, if change value, example adding letters, , later change condition of ng-if, , after value one-time binding has been refreshed.

html:

  <div ng-if="a" class="blue">{{ ::text }}</div> 

it kind of bug, or expected behaviour?

here example of i'm doing: http://codepen.io/samot/pen/rljadn

if condition of ng-if made false , true, recreate contents, causing one-time ng-bind directive evaluated again.

the thing 1 time binding avoid adding watch on expression, doesn't "cache" or "store" result case content of directive compiled again.

so it's expected behavior.


Comments

Popular posts from this blog

Sass watch command compiles .scss files before full sftp upload -

filehandler - java open files not cleaned, even when the process is killed -

gridview - Yii2 DataPorivider $totalSum for a column -