Awakening Awakening - 4 months ago 38
AngularJS Question

angularjs one-way-data-binding, can angular do it?

I have a simple question about angularjs one-way-data-binding.

Assume that in same page, we have two input box A and B,

How can they work like:

input A will change input B, but input B will NOT change input A,

I know angular has bindonce, but I want is one-way-data-binding

thanks for your answer..... I tried, but all solutions are failed.........:(

Can we add something like directive to controll it?


You can use ng-value. It will show the model, but not update it. Doesn't require any extra JS wiring.

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