Created
June 30, 2019 16:23
-
-
Save ssougnez/c7b863cff7d373edc210c36fe8bc47f4 to your computer and use it in GitHub Desktop.
This file contains 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
import { Component, Input } from '@angular/core'; | |
@Component({ | |
selector: 'data-table', | |
templateUrl: './data-table.component.html' | |
}) | |
export class DataTableComponent { | |
@Input() | |
public data: number[] = []; | |
public sorted: number[] = []; | |
public ngOnChanges(): void { | |
this.sorted = this.data.sort((item1: number, item2: number) => item1 - item2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment