Reputation: 506
This is my first Angular App which I am building from angular.io documentation. I have followed the same steps as they have mentioned and I see that when I generate new components they are not getting added to app.module so I tried added them and here I am getting the following error
Cannot find module './product-alerts/product-alerts.component'.
This app is being built in stackblitz so please find the links for my project.
EditorURl: https://stackblitz.com/edit/angular-tejatest1
Upvotes: 3
Views: 1881
Reputation: 147
Sometimes this also happens when a component in Stackblitz is created, then deleted. The Imports happens to not get deleted automatically. This can lead to confusing situations.
Upvotes: 1
Reputation: 4308
A similar issue was seen following the exact steps and the solution was IT-Crowd-like: saving the project and reloading the page!
Upvotes: 3
Reputation: 27371
It's because your product-alerts component is outside of app folder. Change your import in module like this: Or move your product-alerts inside app folder.
Try this:
app.module.ts
import { ProductAlertsComponent } from '../product-alerts/product-alerts.component';
Upvotes: 1