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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -