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

后端 未结 24 1975
无人共我
无人共我 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条回答
  •  萌比男神i
    2020-12-13 08:39

    Open command prompt, go to the app folder, e.g. D:\angular-tour-of-heroes\src\app

    Then create a new file using the following command:

    ng generate class hero
    

    This will create a hero.ts file. Then you can paste the export code, and the error is gone.

提交回复
热议问题