skip to Main Content

X [ERROR] NG8001: ‘app-chess-board’ is not a known element:

  1. If ‘app-chess-board’ is an Angular component, then verify that it is part of this module.

  2. If ‘app-chess-board’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message. [plugin angular-compiler]

    src/app/app.component.html:0:0:
    0 │
    ╵ ^

Error occurs in the template of component AppComponent.

src/app/app.component.ts:5:15:
  5 │   templateUrl: './app.component.html',
    ╵                ~~~~~~~~~~~~~~~~~~~~~~

(https://i.sstatic.net/EgwggzZP.png)]

(https://i.sstatic.net/nu469YAP.png)]

(https://i.sstatic.net/mdTGoaBD.png)

2

Answers


  1. just import ChessBoardComponent in AppComponent or related module:

    @Component({
      selector: 'app-root',
      standalone: true,
      imports: [RouterOutlet,ChessBoardComponent ],
      templateUrl: './app.component.html',
      styleUrl: './app.component.scss'
    })
    Login or Signup to reply.
  2. In app.module you should add ChessBoardComponent in export array
    like this :

    @NgModule({
      declarations: [AppComponent],
      imports: [
        ChessBoardComponent
      ],
      exports:[
        ChessBoardComponent 
      ],
      providers: [],
      bootstrap: [AppComponent],
    })
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search