Skip to content

Instantly share code, notes, and snippets.

@azaharafernandezguizan
Created December 21, 2018 11:25
Show Gist options
  • Save azaharafernandezguizan/31ed54273e287bf2135037d90840757d to your computer and use it in GitHub Desktop.
Save azaharafernandezguizan/31ed54273e287bf2135037d90840757d to your computer and use it in GitHub Desktop.
Angular sorting (methods in TypeScript file)
sortTable(prop: string) {
this.path = prop.split('.');
this.order = this.order * (-1); 
return false; 
 }
getIcon(prop:string): string{
//Yo uso iconos font-awesome de ahí la nomenclatura
var iconClass = "fa fa-sort";
if(this.path.indexOf(prop) != -1)
{
iconClass = this.order===-1 ? 'fa fa-sort-down' : 'fa fa-sort-up';
}
return iconClass;
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment