Skip to content

Instantly share code, notes, and snippets.

@tomtobac
Created February 19, 2017 19:46
Show Gist options
  • Save tomtobac/5d7d18b4dd8c21b659a56ab0184d6679 to your computer and use it in GitHub Desktop.
Save tomtobac/5d7d18b4dd8c21b659a56ab0184d6679 to your computer and use it in GitHub Desktop.
export class AppComponent implements OnInit {
companies: Company[];
path: string[] = ['company'];
order: number = 1; // 1 asc, -1 desc;
constructor(private dataService: MockDataService) {}
ngOnInit(): void {
this.companies = this.dataService.getCompanies();
}
sortTable(prop: string) {
this.path = prop.split('.')
this.order = this.order * (-1); // change order
return false; // do not reload
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment