Angular 2: how to create radio buttons from enum and add two-way binding?
<p>I'm trying to use Angular2 syntax to create radio buttons from an enum definition, and bind the value to a property that has the type of that enum.</p>

<p>My html contains:</p>

<pre><code>&lt;div class="from_elem"&gt;
    &lt;label&gt;Motif&lt;/label&gt;&lt;br&gt;
    &lt;div  *ngFor="let choice of motifChoices"&gt;
        &lt;input type="radio" name="motif" [(ngModel)]="choice.value"/&gt;{{choice.motif}}&lt;br&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>In my @Component, I declared the set of choices and values:</p>

<pre><code>private motifChoices: any[] = [];
</code></pre>

<p>And in the constructor of my @Component, I filled the choices the following way:</p>

<pre><code>constructor( private interService: InterventionService )
{
    this.motifChoices =
        Object.keys(MotifIntervention).filter( key =&gt; isNaN( Number( key )))
            .map( key =&gt; { return { motif: key, value: false } });
}
</code></pre>

<p>The radio buttons are displayed correctly, now I seek to bind the value selected to a property. But when I click one of the buttons the value choice.value is set to undefined.</p>