StaticInjectorError(平台:核心)[RegistrationComponent -> ToastrManager]

StaticInjectorError(Platform: core)[RegistrationComponent -> ToastrManager]

[由于 toastr 管理器导致测试组件时出错][1]

<img src="https://i.stack.imgur.com/hjhd9.png">

我没有在此组件中使用 toastr 管理器,但它仍然显示错误。

"Error: StaticInjectorError(DynamicTestModule)[RegistrationComponent -> ToastrManager]: 
  StaticInjectorError(Platform: core)[RegistrationComponent -> ToastrManager]: 
    NullInjectorError: No provider for ToastrManager!"

这是因为 RegistrationComponent 中存在的一些子组件正在使用它。

因此,当您创建 RegistrationComponent 时,子组件 UI 也在测试浏览器中呈现,但它失败了。