Monday, January 20, 2020

how to fix "error NG8001: "your selector'' is not a known element" in Angular Development

after i run npm build to compile my angular project

i got the following error

C:\DanAngular\triathlon-app>ng build

ERROR in src/app/results/results/results.component.html:2:1 - error NG8001: 'results-list' is not a known element:
1. If 'results-list' is an Angular component, then verify that it is part of this module.
2. If 'results-list' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

2 <results-list (selected)=showDetails($event)>Loading athelete list ...</results-list>


when i go inside my project and locate the results-list.component.ts

the selector had been defined as app-results-list

@Component({
  selector: 'app-results-list',
  templateUrl: './results-list.component.html',
  styleUrls: ['./results-list.component.scss']
})
export class ResultsListComponent implements OnInit {
  athletesAthlete[];
  timingPointsTimingPoint[];
  @Output() selected=new EventEmitter<Athlete>();

  constructor(private athleteServiceAthleteServiceService) { }



 <results-list (selected)=showDetails($event)>Loading athelete list ...</results-list>

should use app-results-list as the selector.

 <app-results-list (selected)=showDetails($event)>Loading athelete list ...</app-results-list>



No comments:

Post a Comment