Marco Jr
Marco Jr

Reputation: 6796

Is there some way to don't show the component name on the html in Angular 2 or superior?

This component...

<my-component>
   <p>Hello !</p>
</my-component>

...Inside the html template....

<div class="myClass">
   <my-component></mycomponent>
</div>

...Will render something like this on the client side:

<div class="myClass">
   <my-component>
     <p>Hello !</b>
  </mycomponent>
</div>

Is there some how to not display the component html tag , but display the components inner content ? Something like...

<div class="myClass">
      <p>Hello !</b>
</div>

Upvotes: 6

Views: 1913

Answers (1)

user4676340
user4676340

Reputation:

Since you have a selector, you could try to do

<div class="myClass">
   <div my-component></div>
</div> 

Otherwise, according to this page

Directives that replace their host element (replace: true directives in Angular 1) are not supported in Angular 2. In many cases these directives can be upgraded over to regular component directives.

Upvotes: 2

Related Questions