Angular Error: Is it missing an @NgModule annotation?
Fehlermeldung in ng serve:
Is it missing an @NgModule annotation?
Lösung:
In app.module.ts muss die neue Componente nicht in imports, sondern in declarations eingetragen werden
VC Code Terminal nach Compiled successfully
Error: src/app/components/spinner2/spinner2.component.ts:9:14 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.
Is it missing an @NgModule annotation?
9 export class Spinner2Component implements OnInit { |
App.module.ts
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core';
import { Spinner2Component } from "../app/components/spinner2/spinner2.component";
import { AppComponent } from './app.component';
@NgModule({ declarations: [ AppComponent, Spinner2Component, ], imports: [ BrowserModule,
], providers: [], bootstrap: [AppComponent] }) export class AppModule{ }
|