Hi I have this folders in my project But When I run I get this error
Any idea please?
regards
This usually happens when you try to create a file using your IDE viz VS code etc. while your code is still compiling. You can stop the server using ctrl+c and then start then start it again using ng serve command to resolve the issue. Make sure that you saved all the files before running ng serve command .
Thanks to @Hisham Afzal Ahamed for the solution (stopping and re-starting the Angular compiler).
CTRL-C, CTRL-C
(or CTRL-C
then Y
)ng serve
(or whatever else you're using e.g. a custom npm
script)Basically the Angular CLI sometimes doesn’t ‘see’ files that have been pulled in (e.g. when doing a merge while your compiler is running). Very useful to know. As a general time saver, If you’re pulling files into your solution or doing something similar, or you get an Angular compiler error that makes no sense, or you've made significant changes somehow, it’s always worth stopping then restarting the compiler to do a fresh build - it can save so many headaches!
Rerunning ng serve
should help fix the issue. You must have added empleado.ts
while the local server was still running, hence Angular would not have seen the file.
Try to put your empleado.ts
file into assets folder and then fetch the file from there.
As, angular recommends to put all your resources in the assets folder including images/fonts/json etc and access from there.
PS: assuming this file contains your static content like dummy data etc.
I guess empleado.ts
is your class model for empleado, so you need to import in in your app.module