I have created an interface of User to put in some value from ngModel. Take a look at this.
user.ts
export class User{
_id: String;
username: String;
password: String;
firstname: String;
lastname: String;
gender: String;
address: String;
contact: Number;
email?: String;
}
Example of ngModel binding
<input type="text" [(ngModel)]="user.username" class="form-control" name="username" id="username" placeholder="Enter your Username" formControlName="username"/>
Output from the console log
I want to make the result to a json. I use JSON.parse but the error on the title pops up. How can I convert it to a json object? Thanks
