Javascript 将变量传递给嵌套组件

Javascript 将变量传递给嵌套组件,javascript,angular,typescript,ngfor,Javascript,Angular,Typescript,Ngfor,在我的父组件属性页.component.html中,我迭代了propertiesArray,并希望在此基础上显示属性卡的列表 <property-card *ngFor="let propertiesItem of propertiesArray" [propertiesItem] = "propertiesItem" ></property-card> 属性卡.component.html: export class PropertyCardCompo

在我的父组件属性页.component.html中,我迭代了
propertiesArray
,并希望在此基础上显示
属性卡的列表

<property-card
    *ngFor="let propertiesItem of propertiesArray"
    [propertiesItem] = "propertiesItem"
></property-card>
属性卡.component.html

export class PropertyCardComponent implements OnInit {
    @Input() propertiesItem: any;
    constructor() {}
    ngOnInit() {}
}
<div class="upload-card-content">
    <mat-card-header>
        <mat-card-title>{{ propertiesItem.id }}</mat-card-title>
    </mat-card-header>
    <mat-card-content>{{ propertiesItem.designation }}</mat-card-content>
        <mat-card-footer>
            <span class="icon-icon_calendar"></span>
            Period:
            <span class="period">{{ propertiesItem.period }}</span>
        </mat-card-footer>
</div>

{{propertiesItem.id}
{{propertieItem.designation}
期间:
{{propertieItem.period}
问题


出于某种原因<代码>属性项
在子组件中未定义。有人能解释一下我遗漏了什么吗?

尝试向子组件添加
*ngIf
,如下所示:


{{propertiesItem.id}
{{propertieItem.designation}
期间:
{{propertieItem.period}

属性数组是什么样子的?可能
属性数组
包含
未定义的
,例如
[1,2,未定义,4]
变量
属性项
的传递有问题,因为当不将
属性卡
与父组件分离时(制作一个公共组件),
属性项
工作
属性项
未定义的
如果您
控制台。在
ngOnInit()中记录它