Home > Enterprise >  Angular: Can't call component I created
Angular: Can't call component I created

Time:05-17

I created a new component,But I can not read it in the app.

In my main component file: app.component.html I have:

<h1>First App</h1>
<app-red-light></app-red-light>

In my second component file: red-light.component.html

I have:

<p>red-light works!</p>

Which I call red-light In main components so it does not appear to me

My App.Module:

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

import { AppComponent } from './app.component';
import { RedLightComponent } from './red-light/red-light.component';

@NgModule({
  declarations: [
    AppComponent,
    RedLightComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

CodePudding user response:

Have you re-builded your application once more? Changes involving the modules(for instance creating new components) require running the application by ng serve again

  • Related