Dynamically load HTML template in angular2

You could use [innerHtml] in a my-template component with something like this (I didn’t test) : @Component({ selector: ‘my-template’, template: ` <div [innerHtml]=”myTemplate”> </div> `}) export public class MyTemplate { private myTemplate: any = “”; @Input() url: string; constructor(http: Http) { http.get(“/path-to-your-jsp”).map((html:any) => this.myTemplate = html); } }

Equivalent of $compile in Angular 2

Angular 2.3.0 (2016-12-07) To get all the details check: How can I use/create dynamic template to compile dynamic Component with Angular 2.0? To see that in action: observe a working plunker (working with 2.3.0+) The principals: 1) Create Template 2) Create Component 3) Create Module 4) Compile Module 5) Create (and cache) ComponentFactory 6) use … Read more

How can I use/create dynamic template to compile dynamic Component with Angular 2.0?

EDIT – related to 2.3.0 (2016-12-07) NOTE: to get solution for previous version, check the history of this post Similar topic is discussed here Equivalent of $compile in Angular 2. We need to use JitCompiler and NgModule. Read more about NgModule in Angular2 here: Angular 2 RC5 – NgModules, Lazy Loading and AoT compilation In … Read more