简体   繁体   中英

Remove wrapper from Angular component

Is it possible to add a component and keep only it's content?

Example of using a component:

<my-custom-component></my-custom-component>

This is rendered like:

<my-custom-component>
  <div> ... </div>
</my-custom-component>

Is it possible to render the content only? In this case it would be:

<div> ... </div>

I need this cause is screwing my CSS rules.

There is feature request that looks like you want to have

For now you can workaround it by using attribute selector:

<div myComponent> ... </div>


@Component({
  selector: '[myComponent]'
  ...
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM