触发条件:
- 父组件使子组件输入属性值变化时才会调用,子组件自己改变输入属性的值不会调用
- @input属性(输入属性)发生变化时,会调用
- 当输入属性为对象时,当对象的属性值发生变化时,不会调用
- 当对象的引用变化时会触发
父组件
//app.component.html
<app-child [greeting]="greeting" [user]="user"></app-child>
<p> 问候语:<input type="text" [(ngModel)]="greeting"><
触发条件:
父组件
//app.component.html
<app-child [greeting]="greeting" [user]="user"></app-child>
<p> 问候语:<input type="text" [(ngModel)]="greeting"><