I have the following structure in my project,
src
- component-a
-- component-a.component.ts
-- component-a.html
-- component-a.scss
-- component-a.component.spec.ts
- component-b
-- component-b.component.ts
-- component-b.html
-- component-b.scss
-- component-b.component.spec.ts
- app.component.ts
- app.module.ts
- app.html
I'm using component-a inside my app.component.ts, so I have included it in declarations in the app.module.ts.
declarations: [
App, ComponentA,
],
And in the app.html: <component-a></component-a>
Now I want to add component-b inside my component-a.
So whatever I tried, when I use <component-b></component-b>
inside component-a.html I get this error:
Unhandled Promise rejection: Template parse errors:
'component-b' is not a known element:
1. If 'component-b' is an Angular component, then verify that it is part of this module.
2. If 'component-b' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
[ERROR ->]<component-b></component-b>
"): ng:///AppModule/ComponentA.html@7:6 ; Zone: <root> ; Task: Promise.then ; Value:
How do use component-b in component-a.html?
- I tried importing component-b in component-a.component.ts
- I tried importing and adding component-b in the app.module.ts declarations.