i'm trying to teach myself angular2. I trying to build component "trigger-resize", which i want to render as :
<a class="hidden-xs" href="">
<em class="fa fa-navicon"></em>
</a>
and NOT as:
<trigger-resize>
<a class="hidden-xs" href="">
<em class="fa fa-navicon"></em>
</a>
</trigger-resize>
(i dont want custom selector to render)
In angular 1. i know it would be achieved by "replace:true" option, but is it possible to achieve it in angular2?
Kind Regards
One way to do it is to use an attribute
<a triggerResize class="hidden-xs" href=""></a>
Which has a component like
@Component({
selector : 'a[triggerResize]', //select all <a> tags with triggerResize attribute
template : '<em class="fa fa-navicon"></em>'
})
CamelCase attributes are the proper syntax now for custom attributes in angular2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With