5

Thanks to this very insightful post I am able to create components on the fly with a dynamic template fetched from an endpoint, however these components are compiled at runtime using the RuntimeCompiler, which is disabled when using AoT compilation, AKA when in production.

Is anyone aware of a similr solution that works with AoT?

My requirements are:

  • fetch the component's template at runtime
  • store some data from a endpoint into a property of the component
  • have Angular parse the template, especially the contained bindings that work on the property containing data from the endpoint
Cec
  • 1,726
  • 3
  • 18
  • 31

1 Answers1

0

I'm also looking for the solution. I've tried solution given here How can I use/create dynamic template to compile dynamic Component with Angular 2.0? but it won't work with Angular 5 AOT. Compiler is not avaible at Runtime.

Also there is a problem with JitCompilerFactory and I think it is related to that topic https://github.com/angular/angular/issues/20639 .

Maybe that gonna be the solution How to load dynamic external components into Angular application Haven't tried it yet. I will check it soon. Maybe it will help you.

Patryk Panek
  • 405
  • 4
  • 20