I have to change the column's width dynamically, for to do that I made a custom directive like that:
@Directive({
selector: '[rq-column-size]'
})
export class ColumnSizeDirective {
@Input('rq-column-size') set rqColumnSize( width: string) {
this.eleRef.nativeElement.style.width = width + '%';
}
constructor(private eleRef: ElementRef) { }
}
used into HTML:
<th [rq-column-size]="col.width" ....
the question is:
is it better to use [ngStyle] or my custom directive?