angular - Complex two way data binding with ngModel -
i'll start showing code before explaining porblem :
export class person { firstname: string; lastname: string; } @component({ selector: 'app-person', template: ` <input type="text" name="firstname" [(ngmodel)]="buyer"> <!-- code autocomplete, when selecting person autocomplete, object person binded buyer --> ` }) export class personcomponent { buyer: person; // code autocomplete }
my problem when user select person autocomplete, input showing [object object] normal. how make show firstname bind input object buyer ?
thank you
change [(ngmodel)]="buyer" [(ngmodel)]="buyer.firstname" or property name has buyer
<input type="text" name="firstname" [(ngmodel)]="buyer.firstname">
Comments
Post a Comment