最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Cannot read property 'setProperty' of undefined fxFlex issue with ng-container Angular 9 Flex Layou

programmeradmin0浏览0评论
<div [fxLayout]="fields.layoutConfig.layoutDirection + ' wrap'" fxLayout.xs="column"
    [fxLayoutGap]="fields.layoutConfig.fxLayoutGap">

    <ng-container [fxFlex]="50" *ngFor="let field of fieldsponentConfig;" reactiveField [field]="field" [group]="form">
    </ng-container>

</div>

Trying to use the [fxFlex]="50" inside the container getting an error Cannot read property 'setProperty' of undefined

Some of the issues

<div [fxLayout]="fields.layoutConfig.layoutDirection + ' wrap'" fxLayout.xs="column"
    [fxLayoutGap]="fields.layoutConfig.fxLayoutGap">

    <ng-container [fxFlex]="50" *ngFor="let field of fields.ponentConfig;" reactiveField [field]="field" [group]="form">
    </ng-container>

</div>

Trying to use the [fxFlex]="50" inside the container getting an error Cannot read property 'setProperty' of undefined

Some of the issues https://github./angular/flex-layout/issues/1046 https://github./angular/flex-layout/issues/381

Share Improve this question edited Apr 30, 2020 at 14:42 San Jaisy asked Apr 30, 2020 at 12:12 San JaisySan Jaisy 17.2k43 gold badges205 silver badges346 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

you shouldn't use property binding for fxLayout and fxLayoutGap.

I had the same issue with

 <ng-container fxLayout="row" fxLayoutAlign="right">

by changing <ng-container> into a <div> the error was gone...

Bind the container inside the <div>

<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.ponentConfig;">
        <ng-container reactiveField [field]="field" [group]="form"></ng-container>
    </div>
</div>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论