File 'app/hero.ts' is not a module error in the console, where to store interfaces files in directory structure with angular2?

后端 未结 24 1963
无人共我
无人共我 2020-12-13 07:55

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

24条回答
  •  一整个雨季
    2020-12-13 08:37

    probably you forgot to add "Export" in the class definition.

    -->

    export class Hero {
         id: number;
         name: string;
       }
    

    Also, try with

    export {Hero} 
    

    at the bottom of your hero.ts class, and finally, check capital letter file name and class name.

提交回复
热议问题