I am doing the angular2
tutorial at this address: https://angular.io/docs/ts/latest/tutorial/toh-pt3.html I have put the hero
interface in a single file under the app
folder, in the console I have this error:
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.
If I put my interface file in a hero folder the error disappear, this is not mentioned in the documentation, what's wrong with my import?
My import directive (at the beguining of the component files) in both app.components.ts
and hero-detail.component.ts
:
import {Component} from 'angular2/core';
import {Hero} from './hero';
Must I replace my import directive by: import {Hero} from './';
or simply put the code in a hero folder?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…