app HTML
<div class="parent">
<div>
问候语:<input type = "text" [(ngModel)]="greeting">
</div>
<div>
姓名: <input type = "text" [(ngModel)]="user.name">
</div>
</div>
<app-child [greeting]="greeting" [user]="user "></app-child>
app TS
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
greeting = 'Hello';
user: {name: string} = {name: 'Jenny'};
// tslint:disable-next-line:use-lifecycle-interface
ngOnInit(): void {
}
}
child HTML
<div class="ch