ERROR Message
'app-CommodityList' is not a known element:
- If 'app-CommodityList' is an Angular component, then verify that it is part of this module.
- If 'app-CommodityList' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
When i add CUSTOM_ELEMENTS_SCHEMA it doesn't fix the error and add a new one it shows:
NgModule.schemas must be an array
Value could not be determined statically.
app.module.ts
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { CommodityListComponent } from './CommodityList/CommodityList/CommodityList.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
@NgModule({
declarations: [
AppComponent,
CommodityListComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule
],
providers: [],
bootstrap: [AppComponent],
schemas:[ CUSTOM_ELEMENTS_SCHEMA ]
})
export class AppModule { }
app.component.html
<app-CommodityList></app-CommodityList>
CommodityList.html
<p>
CommodityList works!
</p>
CommodityList.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-CommodityList',
templateUrl: './CommodityList.component.html',
styleUrls: ['./CommodityList.component.scss']
})
export class CommodityListComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
Angular Version i'm using is 12.0.1