vendredi 26 février 2021

Errro add component in Angular 11

When I try to add a component to app, appears this error but I don't know what is happen

My code

Error: src/app/product/product.component.ts:7:14 - error NG6002: Appears in the NgModule.imports of AppModule, but could not ble.imports of AppModule, but could not be resolved to an NgModule class.

Is it missing an @NgModule annotation?

product.component.ts in app/product

import { Component, OnInit } from '@angular/core';
@Component({
  selector: 'app-product',
  templateUrl: './product.component.html',
  styleUrls: ['./product.component.scss']
})
export class ProductComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }

}

app.module.ts

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

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ProductComponent } from './product/product.component';

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

app.component.html

<app-product></app-product>



Aucun commentaire:

Enregistrer un commentaire