Angular JS 1.3+ One time binding for ng-bind with a ternary condition Angular JS 1.3+ One time binding for ng-bind with a ternary condition angularjs angularjs

Angular JS 1.3+ One time binding for ng-bind with a ternary condition


Yes. The whole expression, whatever it is, will be parsed and read once.

What will happen internally would be equivalent to:

// If not boundvalue = $parse("model.boolean ? 'json.item.value1' : 'json.item.value2'")(scope)

Note: If model.boolean is true, you will actually see the string "json.item.value1" and not the real value it contains. If you want to evaluate that, you need to remove the single quotes ' so it becomes:

<span data-ng-bind="::model.boolean ? json.item.value1 : json.item.value2"></span>