Except for adding the class in html.
I mean something like that:
In html
<my-component></my-component>
In js
angular.module('app').component('myComponent', {
template: '<div class="inner-element">Inner element</div>',
className: 'outer-element' <--- wanted property
});
This is how I want it to look after render:
<my-component class="outer-element"> <--- that's what I want to get
<div class="inner-element">Inner element</div>
</my-component>
You could specify controller that adds class on component init
controller: function($element) {
this.$onInit = function() {
$element.addClass('outer-element')
};
}
But this kinda goes against encapsulation and such.
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