Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

meaning of :: in angular formly

i'm trying to learn how to work with angular firmly and i'm having trouble understanding some of the syntax used in the guides and examples on the official website. when defining a button form 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 the "to.type" and "to.btnType"? how is it being used? how is that different from defining it like this:

<a ng-class="{'btn-primary': to.isPrimary, active: to.isActive}" class="btn, btn-default"/>
like image 561
Dror Cohen Avatar asked Sep 30 '15 08:09

Dror Cohen


1 Answers

It is a one-time binding expression, it stops the proliferation of watchers which can often cause performance issues.

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

like image 114
Jamiec Avatar answered Oct 03 '22 03:10

Jamiec