diff --git a/src/pages/pd-question/pd-question-loans/pd-question-loans.ts b/src/pages/pd-question/pd-question-loans/pd-question-loans.ts index 8469d759..3ddd8f7c 100755 --- a/src/pages/pd-question/pd-question-loans/pd-question-loans.ts +++ b/src/pages/pd-question/pd-question-loans/pd-question-loans.ts @@ -461,7 +461,8 @@ export class PdQuestionLoansPage { mortage_type(mortage_value) { let mortagetypes = this.m_mortageTypeProperty.filter(mor=>mor.mortage_property_id==mortage_value)[0]; - let property_name = mortagetypes.property_name.replace(/\s/g, "").toLowerCase(); + if(mortagetypes != undefined){ + let property_name = mortagetypes.property_name.replace(/\s/g, "").toLowerCase(); if(property_name=='others(pleasespecify)' || property_name=='others') { this.mortageAccess = true; @@ -469,6 +470,9 @@ export class PdQuestionLoansPage { { this.mortageAccess = false; } + + } + } @@ -506,6 +510,7 @@ export class PdQuestionLoansPage { data => { this.m_endUseForLoan = data['records'].filter(data => data.isactive == 1); }); + this.loanDetailsForm.controls['end_use'].setValue(''); } ChangeProperty(subproduct_id){ @@ -537,7 +542,9 @@ export class PdQuestionLoansPage { //this.endUserList = []; event.forEach(option => { let othresData = this.m_endUseForLoan.filter(sub=>sub.enduse_of_loan_id==option)[0]; + if(othresData != undefined){ othresData = othresData.enduse_of_loan.substr(0,6).toLowerCase(); + } this.endUserList.push({ end_use: option }); if (othresData == 'others') { @@ -624,9 +631,13 @@ export class PdQuestionLoansPage { // } // get end user final group data let dataEnd_user_data = []; - this.loanDetailsForm.controls['end_use'].value.forEach(element => { - dataEnd_user_data.push({end_use: element}) - }); + console.log(this.loanDetailsForm.controls['end_use'].value.length> 0); + if(this.loanDetailsForm.controls['end_use'].value.length> 0){ + this.loanDetailsForm.controls['end_use'].value.forEach(element => { + dataEnd_user_data.push({end_use: element}) + }); + } + records.end_use_group = dataEnd_user_data; if (this.isOtherPurpose) {