I’m using Ionic 4, Angular 7, and Stencil 0.17.
All the other posts I found were either out of date or referred me to the Stencil Angular integration guide.
I followed that guide and still get this error:
Uncaught (in promise): Error: Template parse errors:
'analog-clock' is not a known element:
1. If 'analog-clock' is an Angular component, then verify that it is part of this module.
2. If 'analog-clock' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
I created a git repository from the dist folder of the Stencil component here:
And imported it into this starter app:
I added the CUSTOM_ELEMENTS_SCHEMA to the app.module.
And I added the defineCustomElements(window); bit to main.ts.
I’ve found a solution. I added CUSTOM_ELEMENTS_SCHEMA to a shared module which I was importing in all my modules. When I added CUSTOM_ELEMENTS_SCHEMA to the module from the component where I wanted to use the Web Component as well, it started the work.
I’m not sure why it doesn’t work when only adding CUSTOM_ELEMENTS_SCHEMA to the SharedModule.