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

后端 未结 15 1869
忘掉有多难
忘掉有多难 2020-11-21 05:14

I want to dynamically create a template. This should be used to build a ComponentType at runtime and place (even replace) it somewhere inside of the ho

15条回答
  •  死守一世寂寞
    2020-11-21 05:45

    Solved this in Angular 2 Final version simply by using the dynamicComponent directive from ng-dynamic.

    Usage:

    Where template is your dynamic template and context can be set to any dynamic datamodel that you want your template to bind to.

提交回复
热议问题