在角度2(Beta)中将一个服务注入另一个服务的最佳方法是什么?我知道如何将服务注入组件(通过@Component),但如何使用DI传递组件之外的服务?换句话说,我不想这样做:export class MyFirstSvc {}export class MySecondSvc {
constructor() {
this.helpfulService = new MyFirstSvc();
}}export class MyThirdSvc {
constructor() {
this.helpfulService = new MyFirstSvc();
}}
添加回答
举报
0/150
提交
取消
