K
K
Klein Maximus2017-10-16 14:46:59
JavaScript
Klein Maximus, 2017-10-16 14:46:59

How to dynamically set a component in Angular?

Vue.js has the ability to specify the is attribute , which allows you to dynamically set the component in the template, i.e. , it will render the component whose tag name is in comp. Is it possible to do the same (or somehow differently) in Angular? <my-comp :is="comp"> ... </my-comp>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Klein Maximus, 2017-10-17
@kleinmaximus

https://habrahabr.ru/company/infowatch/blog/330030/

S
Sasha Novik, 2017-10-17
@navix

For dynamic rendering of a component, there is a structural directive *ngTemplateOutlet:
https://angular.io/api/common/NgTemplateOutlet

A
asdz, 2017-10-16
@asdz

You yourself find such pieces in html in DOMContentload and compile such pieces yourself as you want.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question