Created
December 21, 2018 11:25
-
-
Save azaharafernandezguizan/31ed54273e287bf2135037d90840757d to your computer and use it in GitHub Desktop.
Angular sorting (methods in TypeScript file)
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
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