我在' https://angular.io/tutorial/toh-pt6'中学习了Angular,但在编译时,它说“找不到内存中的角度 - 网络API”,所以我添加& #34;角内存的Web-API":"〜0.3.0"在package.json中。 但是当它运行时,它在英雄细节和英雄搜索
中都没有显示任何内容https://angular.io/tutorial/toh-pt6中的所有代码都相同 有人可以帮助我
这里是app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms'; // <-- NgModel lives here
import {HttpModule} from '@angular/http';
import { AppComponent } from './app.component';
import {DashBoardComponent} from './dashboard.component';
import {HeroDetailComponent} from './hero-detail.component';
import {HerosComponent} from './heros.component';
import {HeroService} from './hero.service';
import {HeroSearchComponent} from './hero-search.component';
import {AppRoutingModule} from './app-routing.module';
//import for loading & configuring the in-memory web api
import {InMemoryWebApiModule} from 'angular-in-memory-web-api';
import {InMemoryDataService} from './in-memory-data.service';
@NgModule({
declarations: [
AppComponent,
HeroDetailComponent,
HerosComponent,
DashBoardComponent,
HeroSearchComponent
],
imports: [
BrowserModule,
FormsModule, // <-- import the FormsModule before binding with [(ngModel)]
AppRoutingModule,
HttpModule,
InMemoryWebApiModule.forRoot(InMemoryDataService)
],
providers: [HeroService],
bootstrap: [AppComponent]
})
export class AppModule { }