How to render Angular component as control

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.

Popular posts from this blog

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

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS