Skip to content

Instantly share code, notes, and snippets.

@ssougnez
Created June 30, 2019 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssougnez/c7b863cff7d373edc210c36fe8bc47f4 to your computer and use it in GitHub Desktop.
Save ssougnez/c7b863cff7d373edc210c36fe8bc47f4 to your computer and use it in GitHub Desktop.
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