How to solve the circular dependency

前端 未结 2 842
忘了有多久
忘了有多久 2020-12-01 16:44

I have 3 services:

auth.service.ts, account.service.ts, http.service.ts

While user signup I should create new account therefore

2条回答
  •  不思量自难忘°
    2020-12-01 17:15

    @deprecated from v4.0.0 use Type or InjectionToken

    const auth = this.injector.get(AuthService);
    

    Works on Angular 10:

    const AuthService = this.injector.get(AuthService);
    

提交回复
热议问题