A
A
Andrew2019-03-29 07:49:07
Angular
Andrew, 2019-03-29 07:49:07

How to display a component without wrapping it in its own tag?

I don’t know how to google this question, and the title is also difficult to write to make it clear.
In Angular to render a component

@Component({
  selector: 'app-my-component'
})

you need to write a tag on the page and this tag will be displayed on the page and there will be a component inside it, for example
<app-my-component></app-my-component>
///some html code
<app-my-component>/* Some component code */</app-my-component>
///some other html code

Question : how to make the component appear not in the tag, but directly as it is?
///some html code
/* Some component code */
///some other html code

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2019-03-29
@byte916

In general, I found a solution
Change the component to

@Component({
  selector: '[app-my-component]'
})

And use
///some html code
<div app-my-component>/* Some component code */</div>
///some other html code

Not exactly what you need, but it fits.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question