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

前端 未结 4 1529
囚心锁ツ
囚心锁ツ 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:14

    I ran into the same problem. Turns out the solution is "don't do it", as explained in this thread by one of the Angular guys: https://github.com/angular/angular-cli/issues/10170#issuecomment-380673276

    It boils down to services being easier to tree shake when they are provided by the root module, as I gather.

    I'm as disappointed as you are.

提交回复
热议问题