"Component is not a known element"

Hey there! I’m having this error when i try to call a simple component with a It works text from a “page”.

This is my component .ts

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.scss'],
})
export class HeaderComponent implements OnInit {

  constructor() { }

  ngOnInit() {}

}

the “page” from where i want to call the component

<ion-content>

    <app-header></app-header>

</ion-content>

That tag < app-header > is giving me this error: ‘app-header’ is not a known element:

  1. If ‘app-header’ is an Angular component, then verify that it is part of this module.
  2. If ‘app-header’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.Angular

Try reading this thread.

1 Like

Use <ion-header> tag instead of using <app-header>.

Solved! Here’s the video i’ve used