父组件子组件之间传值(父组件异步获取api传值)
父组件
"patientProfileSurvey" [plaquePsoriasisSurvey]="plaquePsoriasisSurvey">
子组件
@Input() patientProfileSurvey:any; ngOnChanges(changes:SimpleChanges){ //get patientProfileDatas if(changes["patientProfileSurvey"]!=undefined){ if(changes["patientProfileSurvey"].currentValue.length){ changes["patientProfileSurvey"].currentValue=changes["patientProfileSurvey"].currentValue.sort((a, b) => b.scheduledDateTime.localeCompare(a.scheduledDateTime)) //get the latest data this.profileSurveyArray=changes["patientProfileSurvey"].currentValue[0]; this.profileSurveyArray=this.profileSurveyArray["surveyQuestionsResponses"].filter(element=>element["externalQuestionID"]=="37034") this.criteriaDatas=this.criteriaDatas.concat(this.profileSurveyArray) } } }