The value :: in angular formally

I am trying to learn how to work with angular firmly, and I am having trouble understanding some of the syntaxes used in the manuals and examples on the official site . when defining button shape control, I saw this template:

<div><button type="{{::to.type}}" class="btn btn-{{::to.btnType}}" ng-click="onClick($event)">{{to.text}}</button></div> 

my question is: what is the meaning of "::" before "to.type" and "to.btnType"? How is it used? how it differs from defining it like this:

 <a ng-class="{'btn-primary': to.isPrimary, active: to.isActive}" class="btn, btn-default"/> 
+8
javascript angularjs angular-formly
source share
2 answers

This is a one-time required expression , it stops the proliferation of observers, which can often cause performance problems.

Here are some useful notes: http://blog.thoughtram.io/angularjs/2014/10/14/exploring-angular-1.3-one-time-bindings.html

+5
source share

This is a one-time required expression.

In your case, when to.type has a given value, it will be updated in the HTML template. Then, if the to.type value to.type again, the HTML template will not be updated with the new value.

More information can be found on the AngularJS website at https://docs.angularjs.org/guide/expression#one-time-binding .

0
source share

All Articles