I am new in Angular2. I have tried to create a component but showing an error.
This is the app.component.ts file.
import { Component } f
In my case I was writing unit tests for a component that uses sub-components, and I was writing tests to make sure those subcomponents were in the template:
it('should include the interview selection subview', () => {
expect(fixture.debugElement.query(By.css('app-interview')))
.toBeTruthy()
});
I didn't get an error, but a warning:
WARN: ''app-interview' is not a known element:
- If 'app-interview' is an Angular component, then verify that it is part of this module. WARN: ''app-interview' is not a known element:
- If 'app-interview' is an Angular component, then verify that it is part of this module.
- If 'app-interview' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.'
Also, the subcomponent did not show inside the browser during testing.
I used ng g c newcomponent to generate all the components, so they were already declared in the appmodule, but not the test module that for the component I was spec'ing.
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditorComponent,
InterviewComponent]
})
.compileComponents();
}));