Angular 6+ :ProvidedIn a non root module is causing a circular dependency

前端 未结 4 1527
囚心锁ツ
囚心锁ツ 2021-01-01 08:21

I\'m trying to provide a resolve service via the new providedIn attribute.

This is a translations resolver which I use in a protected module:

<

4条回答
  •  一向
    一向 (楼主)
    2021-01-01 09:20

    Check forwardRef() function from angular/core. It allows to refer to references which are not yet defined.

    import {MyService} from './service';
    
    constructor(@Inject(forwardRef(() => MyService)) public myService: MyService) {
    }
    

提交回复
热议问题