How to get number in [(ngModel)] in Angular 2?
<p>How to get number in [(ngModel)] in Angular 2?</p>

<pre><code>&lt;select [(ngModel)]="levelNum"&gt;
    &lt;option *ngFor="#level of levels" [value]="level.num"&gt;{{level.name}}&lt;/option&gt;
&lt;/select&gt;

levelNum:number;
levels:Array&lt;Object&gt; = [
    {num: 0, name: "AA"},
    {num: 1, name: "BB"}
];
</code></pre>

<p>I tried to add <code>type="number"</code> in different places.</p>

<pre><code> &lt;select type="number" [(ngModel)]="levelNum"&gt;
    &lt;option *ngFor="#level of levels" [value]="level.num"&gt;{{level.name}}&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>and </p>

<pre><code> &lt;select [(ngModel)]="levelNum"&gt;
    &lt;option type="number" *ngFor="#level of levels" [value]="level.num"&gt;{{level.name}}&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>But when I select a new item, <code>levelNum</code> still becomes a string.</p>