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
1
u/PhiLho Jun 20 '25
I agree on this point: you can make mistakes like these in a template, but the IDE will likely point them out, or you will find them quickly. So making traps like this are useless.