本文介绍了Angular中的HttpClient模块出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能意味着声明HttpClient的库(@angular/common/http)未被ngcc正确处理,或者与Angular Ivy不兼容.检查是否有较新版本的库,如果有,则进行更新.还可以考虑与图书馆的作者进行核对,以查看该图书馆是否与Ivy兼容.

This likely means that the library (@angular/common/http) which declares HttpClient has not been processed correctly by ngcc, oris not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

81导出声明类HttpClient {

81 export declare class HttpClient {

推荐答案

也许您已导入HttpClient而不是HttpClientModule.检查app.module.ts

Maybe you have imported HttpClient instead ofHttpClientModule.Check imports in app.module.ts

imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatToolbarModule,
    FlexLayoutModule,
    HttpClientModule
  ],

这篇关于Angular中的HttpClient模块出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 19:33
查看更多