我始终收到循环依赖的警告
WARNING in Circular dependency detected:
src\app\auth\logout\logout.component.ts -> src\app\auth\_services\authentication.service.ts -> src\app\app.module.ts -> src\app\app-routing.module.ts ->
src\app\auth\logout\logout.component.ts
WARNING in Circular dependency detected:
src\app\theme\layouts\header-nav\header-nav.component.ts -> src\app\_services\data\emp.service.ts -> src\app\app.module.ts -> src\app\theme\layouts\layout.module.ts -> src\app\theme\layouts\header-nav\header-nav.component.ts
WARNING in Circular dependency detected:
src\app\theme\layouts\layout.module.ts -> src\app\theme\layouts\header-nav\header-nav.component.ts -> src\app\_services\data\emp.service.ts -> src\app\app.module.ts -> src\app\theme\layouts\layout.module.ts
WARNING in Circular dependency detected:
src\app\theme\theme-routing.module.ts -> src\app\auth\_guards\auth.guard.ts -> src\app\auth\_services\user.service.ts -> src\app\app.module.ts -> src\app\theme\theme-routing.module.ts
我用过它然后就解决了
"build": {
"showCircularDependencies": false
},
但如何在不使用"showCircularDependencies": false
答案 0 :(得分:2)
我想这是不可能的。
您可以通过将其中一个services
分解为新的service
并仔细包含它们来解除此问题。
看看Single Responsibility Principle。这是回避这些问题的可靠方法。