How to render Angular component as control
Clash Royale CLAN TAG#URR8PPP
How to render Angular component as control
I'm trying to include child component as leaflet control in parent component using innerHTML
property;
innerHTML
legend.innerHTML = '<app-legend></app-legend>';
but it won't render, although definition exists
Does anyone know is there a way to render component using innerHTML
or I should try with directive?
innerHTML
Stackblitz
1 Answer
1
Please take a look at componentFactoryResolvers in this link
There you can dynamically create components and bind them to the view
Cannot read property 'createComponent' of undefined
Use reference in html. <div #parent id="leaflet-map"> </div> and write code in ngAfterViewInit() as viewChild variables will set only after view is initialized
– Niraj Paudel
Aug 10 at 10:17
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I'm trying to implement using componentFacrotyResolvers, but I'm stuck with
Cannot read property 'createComponent' of undefined
error stackblitz.com/edit/…– corry
Aug 10 at 10:05