說明
Description
當某個服務的依賴項直接或間接依賴於此服務本身時,便存在迴圈依賴項。例如,如果 UserService
依賴於 EmployeeService
,而 EmployeeService
也依賴於 UserService
。 Angular 將不得不先實例化 EmployeeService
再建立 UserService
,而 EmployeeService
又依賴於 UserService
本身。
A cyclic dependency exists when a dependency of a service directly or indirectly depends on the service itself. For example, if UserService
depends on EmployeeService
, which also depends on UserService
. Angular will have to instantiate EmployeeService
to create UserService
, which depends on UserService
, itself.