ngModel: Store number

Hey guys,

I’d like to know how I can store a value of an input element as a number instead of a string, and optionally null if nothing is entered. I tried the following, however it’s not storing a number:

<ion-input type="number" [(ngModel)]="user.age">

age is of type number and part of an object (parsed from JSON data from an API).