父组件子组件之间传值(父组件异步获取api传值)

父组件

<app-hct-patient-page-eligibility [patientProfileSurvey]="patientProfileSurvey" [plaquePsoriasisSurvey]="plaquePsoriasisSurvey"></app-hct-patient-page-eligibility>

子组件

  @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)
      }
    }
  
  }

 

上一篇:Spring Boot解决跨域问题


下一篇:Ribbon、Feign和OpenFeign的区别