【发布时间】:2016-01-12 15:59:02
【问题描述】:
我已经为 Angular 2 创建了一个服务:
import {Injectable} from "angular2/core";
import {Http} from "angular2/http";
import {TaskModel} from "./tasks.model"
@Injectable()
export class TasksDataService {
tasks:Array<any>;
constructor(http:Http) {
this.tasks = [
new TaskModel("Dishes"),
new TaskModel("Cleaning the garage"),
new TaskModel("Mow the grass")
];
}
getTasks():Array<any> {
return this.tasks;
}
}
当我运行我的程序时,浏览器显示:
system.src.js:1049 GET http://localhost:3000/angular2/http.js 404 (Not Found)
我查阅了教程,它们以相同的方式包含 angular2/http。有谁知道出了什么问题?
【问题讨论】: