-3

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 input field. Here is an example:

https://plnkr.co/edit/gZ73PNGGg4m45zFuBYZw?p=preview

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

Deepak Kumar Padhy
  • 4,128
  • 6
  • 43
  • 79

1 Answers1

1

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">
Sajeetharan
  • 216,225
  • 63
  • 350
  • 396