S
S
Sergey2018-09-11 11:32:55
Angular
Sergey, 2018-09-11 11:32:55

How to call an angular 6 component in a tag to render it in the body tag?

Is it possible to display this component in the body tag when initializing a component in a tag other than body?

<body>
 <p>
  <my-component/>
 </p>
</body>

It is necessary that when the component is init, it should be like this:
<body>
 <my-component/>
 <p>
 </p>
</body>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2018-09-11
@Sergamers

The article helped - https://blog.angularindepth.com/angular-cdk-portal...
Examples are implemented there both in native angular and using cdk angular (portal)

P
Pantene742, 2018-09-11
@Pantene742

<non-body tag>
<component-selector>component-selector>
non-body tag>
In Angular, everything is placed in a Body. Your app component is loaded into it. further all nested components nested in App will be in Body.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question