angular组件传值
小总结:无论是子传父的@Input 装饰器,还是父传子@Output装饰器,都定义在子组件实例中。
父传子@Input
先贴个官网的图片:
子组件实例
import { Component, Input } from '@angular/core'; // First, import Input
export class ChildItemComponent {
@Input() item: string; // decorate the property with @Input()
}
子组件模板
原创
2020-12-31 11:32:54 ·
1915 阅读 ·
0 评论