角度2错误httpcliendmodule [英] angular 2 error httpcliendmodule

查看:82
本文介绍了角度2错误httpcliendmodule的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

httpclientmodule出现一些错误: 我有app.module.ts并且有代码:

have some error with httpclientmodule: i have app.module.ts and there is code :

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'

and error: nodemodules/@angular/http/http has no exported member 'HttpClientModule'

推荐答案

应从@angular/common/http

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

确保已安装 angular@^4.3.0 (另请参阅文档

柱塞示例

Plunker Example

这篇关于角度2错误httpcliendmodule的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆