我是 Angular 新手,我想通过 Angular 2-way 绑定到嵌套组件来进行内容编辑。这是没有双向绑定的结构。
父模块.ts
this.contactList : Array[contact] =[];
parenModule.html
<div *ngFor="let contact of contactList">
<app-contactCard [contact ]='contact '></app-contactCard>
</div>
嵌套模块.ts
@Input() contact : contact;
嵌套模块.Html
<div>{{this.contact.firstname}}- {{this.contact.firstname}}
是否可以在此处添加 2 路绑定并从嵌套组件写入父联系人数组?
像这样:
<input [(ngModel)]="this.contact.firstname"></input>
还是有更好的方法来实现这一目标?