Angular lazy one-time binding for expressions

Yes. You can prefix every expressions with ::, even the ones in ngIf or ngClass:

<div ng-if="::(user.isSomething && user.isSomethingElse)"></div>
<div ng-class="::{classNameFoo: user.isSomething}"></div>

Actually, the code simply checks that the two first characters in the expression are : in order to activate the one-time binding (and then removes them, thus the parenthesis aren’t even needed). Everything else remains the same.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)