![]() |
1
2
你正在寻找
|
![]() |
2
2
在Angular中,当您想将数据从子组件传递给父组件时,需要使用@Output()装饰器和EventEmitter。然而,你的问题似乎有点混乱。如果要将数据从父组件传递到子组件,可以使用@Input()装饰器,而不是@Output()。 为了澄清这两种情况,以下是使用@Input()和@Output()装饰器在子组件和父组件之间传递数据的正确方法: 将数据从父级传递给子级(使用@Input()): 父组件(Parent.Component.ts): 从“@angular/core”导入{Component};
子组件(Child.Component.ts):
我希望它能帮助你清楚地理解 |
![]() |
Kiara · 根据条件角度显示多个模板 1 年前 |
![]() |
IonicMan · 剑道网格在宽度过大时不显示某些列 1 年前 |
![]() |
Ben5 · 服务器端总是接触FormControl 1 年前 |
|
allforthenoob · 我该怎么分类? 1 年前 |
![]() |
Hugh Jones · 如何创建适用于多个来源的自签名开发证书 1 年前 |
![]() |
jthorn · 角度对象未在HTML中显示 2 年前 |
![]() |
clem · 如何在Angular应用程序中突出显示页面的一部分? 2 年前 |
![]() |
Kael · 在html表格中显示关系api数据-角度 2 年前 |