Search code examples
htmlcssangularjsstackblitz

Import Error on Stackblitz when trying to add component to module file


I'm using Stackblitz to practice angularJS and it's coming up with an error when I attempt to import a component in the app.module.ts file.

Import error, can't find file:
./heroes/heroes.component

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
import { HeroesComponent } from './heroes/heroes.component';

https://stackblitz.com/edit/angular-akxx4e?file=src%2Fapp%2Fapp.module.ts


Solution

  • Update below Changes, because it's in different folder

    import { HeroesComponent } from '../heroes/heroes.component';