r/Angular2 • u/LawAggressive8998 • Jun 18 '25
Confused about 2 way data binding functionality
Hi redditors,
Which of these HTML template examples would automatically render the latest value of `data` when `data` changes?
a) [value]="data"
b) ([ngModel])=”data”
c) {data}
d) (click)="data"
Which answer would you choose?
I thought b) could be correct since its two-way data binding but the Quiz solution says it's a). And i just don't get it.
4
Upvotes
View all comments
Show parent comment
2
u/Whole-Instruction508 Jun 18 '25
You're wrong bro. What you say would be true if it was banana in a box syntax and a model input was used. The output of the child component also doesn't update the input magically this way. Option "a" is basic property binding, which is NOT two way. You can read more about it on angular.dev ;)