我正在angular2以下地址执行教程:https : //angular.io/docs/ts/latest/tutorial/toh-pt3.html我已将hero接口放在文件app夹下的单个文件中,在控制台中出现此错误:
app/app.component.ts(2,20): error TS2306: File 'app/hero.ts' is not a module.
[0] app/hero-detail.component.ts(2,20): error TS2306: File 'app/hero.ts' is not a module.
如果将接口文件放在hero文件夹中,错误消失了,文档中没有提到,导入有什么问题?
我的import指令(在组件文件的beguining)在这两个app.components.ts和hero-detail.component.ts:
import {Component} from 'angular2/core';
import {Hero} from './hero';
我是否必须将导入指令替换为:import {Hero} from './'; 或将代码放在hero文件夹中?
