小编H K*_*H K的帖子

有没有办法将服务从父组件注入到组件中?

所以我有一个表格组件。但是表组件需要使用适当的 API 服务,具体取决于它是由 ComponentA 还是 ComponentB 调用。

例如,如果 ComponentB 使用 TableComponent,那么它需要让 TableComponent 注入 APIForB 服务并使用它来填充表。

角度新手,所以不确定这样的事情是否可能。

dependency-injection angular-services angular-components angular

1
推荐指数
1
解决办法
2008
查看次数