0

One-time data binding:

As its name suggests, the binding happens only once, ie, in the first digest cycle. One-time binding allows for a model or view to be updated ONCE from the value set by the controller upon the first digest

The syntax is {{::expression}}. in angularjs and in angular 2 is here :angular 2 one time binding

Read-only

Sets the readonly attribute on the element, if the expression inside ngReadonly is truthy. Note that readonly applies only to input elements with specific types

The syntax is ng-readonly="expression" and angular 2 have [readonly]="true"

Difference and Question

I guess both are similarly doing the same process but the only difference is read-only is allow to disable the control. So what about the performance between those and their have any other difference?

Milad
  • 27,506
  • 11
  • 76
  • 85
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234

1 Answers1

0

I am answering for the angularjs part :

ng-readonly does not affect performance it only set the readonly attribute of your input. Perhaps you want to combine them if your readonly expression does not change after your directive/controller first load :

ng-readonly="::expression"

With this you prevent angularjs to watch your expression so it's a performance gain.

Drakkin
  • 878
  • 12
  • 27