homepage.module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import { CommonModule } from "@angular/common";
import { HomepageComponent } from "./homepage.component";
import { SharedModule } from "../shared/shared.module";
@NgModule({
declarations: [HomepageComponent],
imports: [
CommonModule,
SharedModule
],
exports: [HomepageComponent],
providers: [],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class HomepageModule {}
shared-module.ts
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import { CommonModule } from "@angular/common";
import { HeaderComponent } from "./header/header.component";
@NgModule({
declarations: [
HeaderComponent,
],
imports: [
CommonModule,
],
exports: [
HeaderComponent,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class SharedModule {}
homepage.component.html
<app-header (toggleSideBarForMe)="sideBarToggler($event)"></app-header>
app.module.ts
import { HomepageModule } from "./homepage/homepage.module";
@NgModule({
declarations: [AppComponent],
imports: [
HomepageModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
while running karma , i am getting the errors . : Failed: Template parse errors: '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. ("[ERROR ->]
Do i need to add anything in the homepage.component.spec file ?