【问题标题】:fxHide and fxShow doesn't seem to be workingfxHide 和 fxShow 似乎不起作用
【发布时间】:2020-05-25 18:55:59
【问题描述】:

我不知道我是否做错了,但 fxHide 和 fxShow 在 @angular/flex-layout 中不起作用。

<p fxHide> Start editing to see some magic happen :) </p>

我正在使用以下依赖项:

"@angular/animations": "^9.1.9",
"@angular/cdk": "^9.2.4",
"@angular/common": "^9.1.9",
"@angular/compiler": "^9.1.9",
"@angular/core": "^9.1.9",
"@angular/flex-layout": "^9.0.0-beta.31"

这是 Stackblitz code 供参考。

【问题讨论】:

  • 请在下面找到答案。

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


【解决方案1】:

在您的应用模块中使用 FlexModule 导入 FlexLayoutModule。它会起作用的。

【讨论】:

    【解决方案2】:

    在你的 app.module.ts 中导入 FlexLayoutModule:

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { FormsModule } from '@angular/forms';
    import { FlexModule, FlexLayoutModule } from '@angular/flex-layout';
    import { CommonModule } from '@angular/common';
    import { AppComponent } from './app.component';
    import { HelloComponent } from './hello.component';
    
    @NgModule({
      imports: [ 
          BrowserModule, 
          FormsModule, 
          FlexModule, 
          FlexLayoutModule, 
          CommonModule ],
      declarations: [ AppComponent, HelloComponent ],
      bootstrap:    [ AppComponent ]
    })
    export class AppModule { }
    

    【讨论】:

      猜你喜欢
      • 2020-02-17
      • 2015-07-06
      • 2016-11-24
      • 2014-06-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多