I have a small issue with my component. Everything is working fine in my browser without any errors, but the Karma debugger throws some errors and as far as I want to have everything clear I would like to fix it.
error:
Failed: Template parse errors:
'dj-menu' is not a known element:
1. If 'dj-menu' is an Angular component, then verify that it is part of this module.
2. If 'dj-menu' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
The <dj-menu>
selector is used in app.component.html
.
menu.component.ts
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'dj-menu',
template: `<nav>
<button mat-button routerLink="/login" routerLinkActive="active">Login</button>
<button mat-button routerLink="/register" routerLinkActive="active">Register</button>
<button mat-button routerLink="/profile" routerLinkActive="active">Profile</button>
<button mat-button routerLink="/radio">Radio</button>
</nav>
`,
styleUrls: ['./menu.component.scss']
})
export class MenuComponent implements OnInit {
{...} // only an empty constructor and ngOnInit()
}
I have a MenuComponent
declared in declarations
in @NgModule
of app.module.ts.
As I said it's working fine in browser, but not in the Karma debugger. So far I tried few answers about similar error (e.g If '<selector>' is an Angular component, then verify that it is part of this module) but nothing is working.
I appreciate any help, thanks.