Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
Render HTML string template that refers internal angular components

I'm trying to render an HTML string template that refers internal angular components & directives which are part of the app.

The question is that bind is lost in components and I don't know how to "preload" directives just like we do with components through entryComponents.

I created a demo project to better explain/demonstrate what I'm trying to achieve with dynamic templates:

There are 3 samples in my demo project:

Sample #1 - Common usage scenario - components are referenced inside my main component and work as expected

Sample #2 - [innerHTML] which obviously doesn't meet the requirements.

Sample #3 - Dynamic render which doesn't work for components since bind is broken and directives are not processed.

https://stackblitz.com/edit/angular-dynamic-html-1pcrbx?file=app/app.component.html

@Component({

})
class MyComponent {

constructor() {}

private myTemplate = `
<hello name="TEST"></hello>
<div test>My div referencing a custom directive</div>
`;

}

  • So, is it possible to do what I'm tying to do? What am I doing wrong?
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda