Ionic 中出现 NullInjectorError: No provider for HttpClient 的解决办法

时间:2018-05-30 00:28:48   收藏:0   阅读:1745

1. 在 app.module.ts 中引入模块

import { HttpClientModule } from ‘@angular/common/http‘;

2. 在 @NgModule.imports 中引入它

@NgModule({
    ......
    imports: [
        ......
        HttpClientModule,
        ......
    ],
    ......
})

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!