Richard
Richard

Reputation: 8955

Ionic Forms with ngModel

I have a form I want to map to an model object. When I add [[ngModel]] to the ion-input, the page does not load (no errors).

html

<ion-input type="text" [(ngModel)]="personModel.username" formControlName="username" id="username"></ion-input>

ts

private personModel: PersonModel = null;
this.personModel = this.navParams.get('personModel');

Any ideas why the [[ngModel]] is not working?

Thanks

Upvotes: 0

Views: 2855

Answers (1)

Richard
Richard

Reputation: 8955

It was my fault. I had the element did not match the model (case match):

[(ngModel)]="personModel.username"

should be

[(ngModel)]="personModel.userName"

Upvotes: 1

Related Questions