Sorting of object of objects property not working in Angular 7 : I am trying to sort and object of an object based on a property field in angular 7 application. I have implemented the sort function but the sort doesn't seem applying. So I basically need to sort LegalFundClassCommercialViewModel on property name RedsFrqncyName.

Following is the code that i have tried

 

    if(this.LegalFundClasses.AllTerms) {
            this.LegalFundClasses.AllTerms.LegalFundClassCommercialViewModel =  this.LegalFundClasses.AllTerms.sort(function(a, b) { return a.LegalFundClassCommercialViewModel.RedsFrqncyName - b.LegalFundClassCommercialViewModel.RedsFrqncyName; });

The values of the property are 


    Daily
    Weekly
    Semi-Monthly
    Monthly
    Quarterly
    Semi-Annually
    Yearly
    Illiquid
    Anniversary
    2nd Anniversary
    3rd Anniversary
    4th Anniversary
    5th Anniversary

JSON


    [{"LegalFundClassCommercialViewModel":{"Description":"Class A (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10651,"FundId":3640,"FundName":"Cevian Capital II Ltd.","FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":"Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures.                                                                                                    * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class B (Soft-Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10656,"FundId":3640,"FundName":"Cevian Capital II Ltd.","FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":10,"RedsFrqncyName":"2nd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":7,"SoftDurationMonthsName":"24","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":4,"WebfolioRedsFee":null,"LockupComments":"Class B Shares may first be redeemed on redemption day falling in the month of the two-year anniversary of the issue of Class B Shares. In the event that a shareholder requests redemption of Class B Shares on the first redemption day falling on the expiration of the initial Class B Shares, the Fund will charge a redemption fee of 4.00% of the redemption proceeds. Following the expiration of Class B lock-up, absent a redemption or exchange of such Class B Shares, such Shares will be subject to a new Class B lock up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the two year anniversary of the commencement of such Class B lock-up. Class B may be redeemed on the redemption day failing on the expiration of each New Class B lock-up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.75,"IncentiveFeeRate":20,"RealizationFrequencyId":21,"RealizationFrequencyName":"Every second anniversary ","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"","ChildRecordExist":true,"Id":10658,"FundId":3640,"FundName":"Cevian Capital II Ltd.","FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"Class C Shares may first be redeemed on the redemption day falling in the month of the one-year anniversary of the issue of such shares. In the event the shareholder requests redemption of Class C Shares falling on the expiration of the initial Class C lock-up, the Fund will charge a redemption fee of 6% of the redemption proceeds. Following the expiration of the initial Class C lock-up, absent a redemption or exchange of such Class C Shares, such shares will be subject to a new Class C lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the anniversary of the commencement of such Class C lock-up. If Class C Shares are redeemed on the redemption day falling on the expiration of the first new Class C lock-up, the Fund will charge a redemption fee of 4% of the redemption proceeds. If Class C Shares are redeemed on the first redemption day falling on the expiration of the second new Class C Shares lock-up or any subsequent new Class C lock-up such Shares may be redeemed without a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up.","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C Interests (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":11812,"FundId":7069,"FundName":"Cevian Capital II LP","FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"In the event that a Limited Partner requests withdrawal of a Class C Capital Account on the Withdrawal Date falling on the expiration of the Initial Class C Lock-Up, the Partnership will retain an amount equal to 6 per cent of the withdrawal proceeds. Following the expiry of the Initial Class C Lock-Up, absent a withdrawal or exchange of such Class C Capital Account, such Class C Capital Account will be subject to a new Class C Lock-Up which will immediately commence on a rolling basis ending on the Withdrawal Date falling in the month of the anniversary of the commencement of such Initial Class C Lock-Up (each, a \"New Class C Lock-Up\"). If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the first New Class C Lock-Up, the Partnership will retain an amount equal to 4 per cent of the withdrawal proceeds. If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the second New Class C Lock-Up or any subsequent New Class C Lock-Up, such Capital Account may be withdrawn without being subject to a withdrawal charge.","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class A Interests (Soft Closed)","AuditSummary":"kweigand Jul 30, 2019","FeesReviewSummary":"kweigand Jul 30, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":11815,"FundId":7069,"FundName":"Cevian Capital II LP","FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":" Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures.                                                                                                    * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":100,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PrefferedReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null}]

