when ad add code on my file as it is on video i get error "./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http'"
when ad add code on my file as it is on video i get error "./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http'"
我是 angular 世界的新人。我试图学习这个框架,但它太难了!...所以在我的第一个例子中我得到了错误:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
错误是:
Failed to compile.
./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/http' in 'C:\Hosts\ng4tutorial\src\app'
我错过了什么..?
检查你的 angular : ng --version
请注意 Http 在 Angular 的 4.3 版中已弃用。
如果您有较新的版本,我建议您使用新的 Api:HttpClient,其中包含许多更新和对进度事件的支持,json 默认反序列化、拦截器和许多其他很棒的功能。
在此处查看如何使用它以及更多信息 https://angular.io/guide/http
我是 angular 世界的新人。我试图学习这个框架,但它太难了!...所以在我的第一个例子中我得到了错误:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
错误是:
Failed to compile.
./src/app/app.module.ts Module not found: Error: Can't resolve '@angular/http' in 'C:\Hosts\ng4tutorial\src\app'
我错过了什么..?
检查你的 angular : ng --version
请注意 Http 在 Angular 的 4.3 版中已弃用。
如果您有较新的版本,我建议您使用新的 Api:HttpClient,其中包含许多更新和对进度事件的支持,json 默认反序列化、拦截器和许多其他很棒的功能。
在此处查看如何使用它以及更多信息 https://angular.io/guide/http