Created
February 19, 2017 19:46
-
-
Save tomtobac/5d7d18b4dd8c21b659a56ab0184d6679 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
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