EXCEPTION: TypeError: articles.filter is not a function
我的服务出错了
import {Injectable} from 'angular2/core';
import {Http} from 'angular2/http';
import 'rxjs/Rx';
@Injectable()
export class ArticlesService {
http:Http;
constructor(http:Http) {
this.http = http;
}
getArticle(id: number) {
return Promise.resolve('./articles.json').then(
articles => articles.filter(article => article.id === id)[0]
);
}
}
Run Code Online (Sandbox Code Playgroud)
我的Plunker但在"英雄之旅"中它运作良好
angular ×1