Remove tag from angular component 6

0

Is there any way to render only the content of the component by hiding the tags?

How it works:

<ul>
    <li-component> </li-component>
</ul>

Render:

<ul>
    <li-component>
        <li>
            Frase
        </li>
    </li-component>
</ul>

It keeps the <li-component> tag

Desired result:

<ul>
    <li>
        Frase
    </li>
</ul>
    
asked by anonymous 19.10.2018 / 22:11

1 answer

0

Welcome to Glauco! : D

It's quite simple, you can change the selector for the " though not recommended " component in the Style Guide

import { Component } from '@angular/core';

@Component({
  selector: 'li[my-component]',
  templateUrl: './my.component.html'
})
export class MyComponent {

  constructor() { }

}

You can basically use an attribute selector even though you have other selectors, it looks like this:

<ul>
    <li my-component> </li>
</ul>

Render like this:

<ul>
    <li my-component>
        Frase
    </li>
</ul>
    
19.10.2018 / 22:22