fix for correct alphabetical in subjects array
This commit is contained in:
parent
cd7a6722ac
commit
e4e79ff31c
|
@ -1 +1 @@
|
|||
Subproject commit db5c95fe248c0e4fe059602185ee8a6161d9949f
|
||||
Subproject commit ad15aaae31acab823f624a64410f33c31d8526f7
|
|
@ -148,8 +148,17 @@ export class SubjectsComponent {
|
|||
//this.getDivContents();
|
||||
this.getPageContents();
|
||||
this.subjects = community.subjects;
|
||||
this.subjects.sort();
|
||||
console.log(this.subjects);
|
||||
this.subjects.sort((a,b) => {
|
||||
if(!a || a.toLocaleUpperCase() < b.toLocaleUpperCase()) {
|
||||
return -1;
|
||||
} else if (!b || a.toLocaleUpperCase() > b.toLocaleUpperCase()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
this.groupSubjects();
|
||||
console.log(this.subjects);
|
||||
this.showLoading = false;
|
||||
}
|
||||
}));
|
||||
|
@ -179,6 +188,10 @@ export class SubjectsComponent {
|
|||
}));
|
||||
}
|
||||
|
||||
// private sortSubjects(a, b) {
|
||||
|
||||
// }
|
||||
|
||||
private groupSubjects() {
|
||||
if(this.subjects.length === 0) {
|
||||
return [];
|
||||
|
|
Loading…
Reference in New Issue