'Is it possible to return custom HTML components from TS file in Angular?

TS FILE

{
  render: (data) => {
    return "<app-custom-component>Hello World</app-custom-component>";
  }
}

HTML FILE

<td>
 {{ render(data) }}
</td>

I tried [innerHTML] but this only works for HTML tags. Custom created components wont appear.



Solution 1:[1]

to load component dynamically you can't use innerHtml , you should use componentFactoryResolver

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Meddah Abdallah