The SVGViewer component在 Angular Material 文档应用程序中声明其模块如下:
@NgModule({
exports: [SvgViewer],
declarations: [SvgViewer],
})
此模块声明的“更多”是否正确:
imports: [HttpClientModule]
既然它使用了HttpClient
? IIUC在一般模块中应该声明它们的依赖关系。
最佳答案
没有。因为它被导入到已经导入 HttpClientModule 的模块中,所以依赖注入(inject)器已经知道 HttpClientModule 了。请参阅 ( https://github.com/angular/material.angular.io/blob/051363fff1f993dd77f70ea9ebf917fbc3f99426/src/app/app-module.ts )
关于javascript - 使用 HttpClient 的模块是否应该在导入中声明 HttpClientModule?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58331231/