In Angular.js 1.3 I can do a one time binding with:
{{::name}}
But how may I use this in ng-bind
?
ng-bind
had some performance improvements in comparison to the {{
syntax.
Is it supported?
At a high-level, one-time data binding means that the template is rendered once based on the current $scope and then it never updates.
One-time binding is used for values that won't change after the page is stable. "Stable" generally means that the expression has been assigned a value. Once the value is set, changes to the value in the controller won't change the displayed value until the page is reloaded. The syntax is {{::expression}}.
AngularJS ng-repeat Directive The ng-repeat directive repeats a set of HTML, a given number of times. The set of HTML will be repeated once per item in a collection. The collection must be an array or an object. Note: Each instance of the repetition is given its own scope, which consist of the current item.
ngModel usually use for input tags for bind a variable that we can change variable from controller and html page but ngBind use for display a variable in html page and we can change variable just from controller and html just show variable.
Yes. This works:
<span ng-bind="::name"></span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With