![]() |
1
2
第一次阅读 Angular Component Interaction . 然后您将知道组件之间有4种主要的通信方式。
在您的场景中,您可以使用任何您想要的方法。 看看这个例子 子组件.ts
child.component.html(子组件.html)
应用组件.ts
app.component.html(应用程序组件.html)
应用程序组件.css
在这里我用了 父级侦听子事件 方法。 我创造了一个 stackblitz 为了这个。 |
![]() |
2
0
HTML: 你好.componemt.html
app.component.html(应用程序组件.html)
TS: 您好,component.ts:
应用组件.ts:
|
![]() |
Taieb · 按条件显示不同的视图 7 年前 |