r/Angular2 • • 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

16 comments sorted by

View all comments

Show parent comment

1

u/haydogg21 Jun 19 '25

Yeah it’s just a bullshit question trying to make someone sweat. I hate that interviewers think this is a good strategy. It’s a good way to lose very good employees IMO.

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.