angular 2错误httpcliendmodule

时间:2017-08-02 08:13:51

标签: angular

enter image description here与httpclientmodule有一些错误: 我有app.module.ts并且有代码:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule }   from '@angular/forms';
import { AppComponent }   from './app.component';
import {HttpClientModule  } from '@angular/http';

@NgModule({
    imports:      [ BrowserModule, FormsModule, HttpClientModule  ],
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ]
})
export class AppModule { }

和错误: nodemodules / @ angular / http / http没有导出的成员' HttpClientModule'

1 个答案:

答案 0 :(得分:4)

应从@angular/common/http

导入
import {HttpClientModule} from '@angular/common/http';

确保您已安装 angular@^4.3.0 changelog

另见文档

<强> Plunker Example