diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html index 28b32866bffbaa6609e1b81e55a1144e4e661b3c..9cb9d57eb1e5b56379fdc23bf47e772a17328566 100644 --- a/src/app/components/shared/comment/comment.component.html +++ b/src/app/components/shared/comment/comment.component.html @@ -331,7 +331,7 @@ <mat-menu #keywordsMenu> <mat-list dense class="keywords-list"> - <mat-list-item *ngFor="let keyword of comment.keywordsFromQuestioner; let odd = odd; let even = even" + <mat-list-item *ngFor="let keyword of sortKeywords(comment.keywordsFromQuestioner); let odd = odd; let even = even" [class.keywords-alternate]="odd" [class.keywords-even]="even"> <span (click)="this.clickedOnKeyword.emit(keyword)" class="keyword-span">{{keyword}}</span> diff --git a/src/app/components/shared/comment/comment.component.ts b/src/app/components/shared/comment/comment.component.ts index c8928f42f761bcb5a853408ec4afa5ef806ef354..a471c154e369d3bd56d88fc77dab6c7caa490a1d 100644 --- a/src/app/components/shared/comment/comment.component.ts +++ b/src/app/components/shared/comment/comment.component.ts @@ -114,6 +114,10 @@ export class CommentComponent implements OnInit, AfterViewInit { } } + sortKeywords(keywords: string[]){ + return keywords.sort((a,b) => a.localeCompare(b)); + } + toggleExpand(evt: MouseEvent) { this.isExpanded = !this.isExpanded; if (this.isExpanded) {