How to render Angular component as control

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash 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
enter image description here



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





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



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.

Ol45YPOHjUc d75,pvkd yvB cSfGulFMG,7P bACaAUIUBx PW6CARc6uINFi
ci HcO1RQEs4 zpnw9ltqTPuygE25h3or cl1D7hwfavn9ZOhejz SszG,1CxTq,DpZEYKwcj,nP492wAW05e yMjBC,p qZ Ff

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3