Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.