Javascript 无法读取属性';setProperty';使用ng容器角度9 Flex布局解决未定义的fxFlex问题
试图在容器内使用[fxFlex]=“50”时出错Javascript 无法读取属性';setProperty';使用ng容器角度9 Flex布局解决未定义的fxFlex问题,javascript,angular,typescript,angular-material,angular-flex-layout,Javascript,Angular,Typescript,Angular Material,Angular Flex Layout,试图在容器内使用[fxFlex]=“50”时出错无法读取未定义的属性“setProperty” 一些问题 您不应该对fxLayout和fxLayoutGap使用属性绑定 将容器绑定到 <div [fxLayout]="fields.layoutConfig.layoutDirection + ' wrap'" fxLayout.xs="column" [fxLayoutGap]="fields.layoutConfig.fxLayoutGap"> <ng-c
无法读取未定义的属性“setProperty”
一些问题
您不应该对
fxLayout
和fxLayoutGap
使用属性绑定 将容器绑定到
<div [fxLayout]="fields.layoutConfig.layoutDirection + ' wrap'" fxLayout.xs="column"
[fxLayoutGap]="fields.layoutConfig.fxLayoutGap">
<ng-container [fxFlex]="50" *ngFor="let field of fields.componentConfig;" reactiveField [field]="field" [group]="form">
</ng-container>
</div>
我必须使用属性绑定,因为fxLayout和fxLayoutGap是动态值,它们不是静态的,fxFlex也是动态值,但要问这个问题,我将其作为静态值引用-
<div [fxLayout]="fields.layoutConfig.fxLayout + ' wrap'" fxLayout.xs="column"
[fxLayoutGap]="fields.layoutConfig.fxLayoutGap"
[fxLayoutAlign]="fields.layoutConfig.fxLayoutAlignHorizontal + ' ' + fields.layoutConfig.fxLayoutAlignVertical">
<div [fxFlex]="fields.layoutConfig.fxFlex" *ngFor="let field of fields.componentConfig;">
<ng-container reactiveField [field]="field" [group]="form"></ng-container>
</div>
</div>