I use the https://github.com/telekom/scale components library (not writing my own library). All components there were built using Stencil and they can be used without problems.
However, I need to change a Stencil component html a bit and add an additional label for example.
The problem is that I cannot find out how to extend Stencil component and override its rendering template.
I know I can just simply reconstruct the template by the sources of render method but I hope there is a better way.
Lets say that we have a component with the
bla-bla-tagselector. There are a couple of options that might be applied depending on your case.Case 1: Prepend some stuff inside nested component
Case 2: Modify DOM
The problem was to wait until inner component fully loads its view.
Fortunately, there was a hook in
HTMLStencilElementinterface:componentOnReady(): Promise<this>;.Stencil docs have the following example:
So the end solution for me was to access the stencil component via
ViewChildand then use the hook from above example.View:
Component code:
Also, I needed to work with some css classes so to prevent Angular from encapsulating them:
ViewEncapsulation.None