【问题标题】:fxFlex angular flex layout not working as expected version 7.0.0-beta.19fxFlex 角度弹性布局无法按预期版本 7.0.0-beta.19 工作
【发布时间】:2019-05-14 14:02:04
【问题描述】:

待办事项:

这是我的代码和我尝试过的:

<div fxLayout="row wrap" fxLayoutGap="32px" fxLayoutAlign="start start">
  <ng-container *ngFor="let _ of [1,2,3,4,5,6]">
    <p fxFlex="0 1 calc(33.3% - 32px)">Flex</p>
  </ng-container>
</div>

文档没有在 api 中提供重大更改。
有人知道这里出了什么问题吗?
或者我应该在 github 上打开一个问题?

【问题讨论】:

  • 第一个 stackblitz 对我不起作用,所以我看不到你想要的输出是什么。但我希望“Flex”连续出现,我会使用 span 而不是 p
  • 嘿,你的第一个 stackblitz 不适合我,但第二个。你可能真的把它们换了吗?
  • 对不起,我编辑了链接
  • @Mel 它应该适用于块元素。我编辑了我的第一个链接

标签: angular angular-material angular7 angular-flex-layout


【解决方案1】:

你忘记在 app.module.ts 中导入 FlexLayoutModule

import { FlexLayoutModule } from '@angular/flex-layout';
import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';

@NgModule({
  imports:      [ BrowserModule, FormsModule, FlexLayoutModule ],
  declarations: [ AppComponent, HelloComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

【讨论】:

  • 这也是我的问题的原因,谢谢。令人惊讶的是,有多少次意外的运行时行为是由缺少模块或轻微不同步的 ng 构建引起的。
猜你喜欢
  • 2019-06-02
  • 2016-08-17
  • 1970-01-01
  • 1970-01-01
  • 2019-02-06
  • 1970-01-01
  • 2018-02-28
  • 2018-09-22
  • 1970-01-01
相关资源
最近更新 更多