import { Injectable } from '@angular/core' ; import { SelectItem } from "../../components/ws-widgets/select/select-item.interface" ; @ Injectable ( ) export class SortingHelperService { constructor ( ) { } public sortDictionariesByKey ( toSort , sortKey ) { return toSort . sort ( function ( a , b ) { if ( a [ sortKey ] > b [ sortKey ] ) { return 1 ; } else if ( a [ sortKey ] < b [ sortKey ] ) { return - 1 ; } else { return 1 ; } } ) ; } public sortSelectItems ( toSort ) { return this . sortDictionariesByKey ( toSort , 'label' ) ; } }