Deepak Kumar Padhy Deepak Kumar Padhy - 4 months ago 11
AngularJS Question

what is double(::) in angular js?

While going through some of the angular best practices guide I found this concept of using

before models for uni-direction binding. But it seems does not work with
field. Here is an example:

Inside expression it works as expected but inside ng-model, it's still 2-way binding. Then what's the difference?


An expression that starts with :: is considered a one-time expression. One-time expressions will stop recalculating once they are stable, which happens after the first digest if the expression result is a non-undefined value (see value stabilization algorithm below).

You can read more about ::

For your requirement, you can just use ng-value

Here is a sample

 <input type="text" ng-model="name">
 <input type="text" ng-value="name">