Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ZackDeRose/cdce7a8932685a1dbe06869ef18449fe to your computer and use it in GitHub Desktop.
Save ZackDeRose/cdce7a8932685a1dbe06869ef18449fe to your computer and use it in GitHub Desktop.
AdjustSort() for "Angular CDK Table" article
adjustSort(key: string) {
if (this.sortKey$.value === key) {
if (this.sortDirection$.value === 'asc') {
this.sortDirection$.next('desc');
} else {
this.sortDirection$.next('asc');
}
return;
}
this.sortKey$.next(key);
this.sortDirection$.next('asc');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment