diff --git a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts index 6c96c13..e090ae9 100644 --- a/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts +++ b/ng6-seed/src/app/personal-discussion/manage-pd/list-pd/start-pd/forms/dynamic-form/dynamic-question-template/dynamic-question-template.component.ts @@ -132,14 +132,14 @@ export class DynamicQuestionTemplateComponent implements OnInit { setTimeout(()=>{ console.log(this.parent_ques); - if( this.parent_ques.answers ){ + if( this.parent_ques.answers && this.parent_ques.answers instanceof Array){ console.log(this.parent_ques.answers.length) console.log( this.formGroupN.get(this.parent_ques.question_key)) - if(this.parent_ques.answers.length == 1){ + if(this.parent_ques.type == '3' && this.parent_ques.answers.length == 1){ console.log(this.parent_ques.answers.answer_id) this.formGroupN.get(this.parent_ques.question_key).patchValue(this.parent_ques.answers[0].answer_id || '') - }else if(this.parent_ques.type == 3 && this.parent_ques.answers.length == 0){ + }else if(this.parent_ques.type == '3' && this.parent_ques.answers.length == 0){ console.log(this.parent_ques.answers.answer_id) this.formGroupN.get(this.parent_ques.question_key).patchValue(this.parent_ques.answers[0].answer_id || '') }