Created
June 9, 2020 14:32
-
-
Save armanozak/7bb72472aab185364b64776e3c32a1d7 to your computer and use it in GitHub Desktop.
[Attribute Directives to Avoid Repetition in Angular] The Default Properties Directive #blog #angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Directive({ | |
// tslint:disable-next-line | |
selector: 'ngx-datatable[default]', | |
exportAs: 'ngxDatatableDefault', | |
}) | |
export class NgxDatatableDefaultDirective { | |
@Input() class = 'material bordered'; | |
@HostBinding('class') | |
get classes(): string { | |
return `ngx-datatable ${this.class}`; | |
} | |
constructor(private table: DatatableComponent) { | |
this.table.columnMode = ColumnMode.force; | |
this.table.footerHeight = 50; | |
this.table.headerHeight = 50; | |
this.table.rowHeight = 'auto'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment