Ionic3错误: StaticInjectorError[HttpModule]:      NullInjectorError: No provider for HttpModule!

 

先在app.module.ts中导入HttpModule,才能在构造函数中注入Http。

Ionic3错误: StaticInjectorError[HttpModule]:      NullInjectorError: No provider for HttpModule!

Ionic自动构建项目时,并没有导入HttpModule。

解决方案:打开app.module.ts,加入导入HttpModule的代码。

import {HttpModule} from "@angular/http";

imports: [
    BrowserModule,
    HttpModule,
    IonicModule.forRoot(MyApp)
]

 

相关文章:

  • 2021-07-08
  • 2021-12-12
  • 2022-03-01
猜你喜欢
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-11-19
  • 2021-06-10
  • 2021-06-15
相关资源
相似解决方案