首页 > 解决方案 > 使用字符串插值显示对象的特定属性

问题描述

我需要通过字符串插值显示一个属性,但它不起作用。似乎一切都很好,但我不知道为什么它不起作用。此外,@Inputed()从父组件到子组件的对象。

<mat-panel-description>
  {{personnelEvaluationList.maxPoint}}
  <mat-icon color="primary">timeline</mat-icon>
 </mat-panel-description>

和 ts 父代码是:

personnelEvaluationList: PersonnelEvaluation[] = [];

getEvaluationPersonnel(req: PersonnelEvaluationRequest) {
        this.isLoading = true;
        this.route.queryParamMap.subscribe(r => {
            this.personnelDetailApiService
                .getEvaluationPersonnel(req)
                .subscribe(res => {
                    this.personnelEvaluationList = (res.result);
                    this.isLoading = false;
                },
                    catchError((err) => {
                        this.snackBar.open('', null, {
                            duration: 5000
                        });
                        return throwError(err);
                    })
                );
        });
}

并且evaluationPersonnelList输入到孩子,这是孩子的ts文件

@Input() personnelEvaluationList: PersonnelEvaluation;

这是父模板

<app-personnel-details-list [personnelProfile]='personnelProfile' 
                  [personnelEvaluationList]='personnelEvaluationList'
                  [personnelVoiceOfCustomersList]='personnelVoiceOfCustomersList' 
                  [personnelAssessmentList]='personnelAssessmentList'>
</app-personnel-details-list>

标签: angular

解决方案


推荐阅读