Reputation: 114
Error: Template parse errors: 'router-outlet' is not a known element: 1. If 'router-outlet' is an Angular component, then verify that it is part of this module. 2. If 'router-outlet' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]"): ng:///DynamicTestModule/AppComponent.html@0:0
Upvotes: 1
Views: 40
Reputation: 1
Adding RouterTestingModule in imports array will do your work.
TestBed.configureTestingModule({ imports: [RouterTestingModule], . . . });
Upvotes: 0
Reputation: 22203
Try this:
Just add the line :
imports: [RouterTestingModule],
in TestBed.configureTestingModule
of your components spec.ts file and
import { RouterTestingModule } from '@angular/router/testing';
Like:
TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [ ComponentHeaderComponent ]
})
Upvotes: 2