lucassp - 1 year ago 78
Javascript Question

# Model won't update in Angular 2 radio list

I'm trying to build a Angular 2 component which displays a list of options with radios. It works fine but it the

answer
field of the component, which is bound inside
[(ng-model)]="answer"
, won't update when selecting one of the options. Am I doing something wrong or isn't this the way to create a list of radio selection options?

  <div>
</div>
<label>
<span>{{ option.name }}</span>
</label>
</div>


Plunker

Well i guess two way binding is now working with radio, so currently you cannot use [(ng-model)].
(change)="answer=\$event.target.value"
[checked]='answer==option.id'