本文介绍了Angular Material FlexLayout fxHide不隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用flex-layout进行垫踏机.每一步都包含一个图标和一个段落,以使其更负责任和更具可读性.我想在较小的屏幕上隐藏该段落,仅保留图标.根据我的理解,如果分辨率低于小值,fxHide.lt-sm应该隐藏element,但是不幸的是没有任何反应,并且看起来像这样:步进图像(Galaxy S5尺寸)

I am working on mat-stepper with usage of flex-layout. Every step contains and icon and a paragraph to make it responsible and more readable I want to hide paragraph on smaller screens and leave only icon. Per my understanding fxHide.lt-sm should hide element if the resolution is lower than small but unfortunately nothing happens and it looks like this:Image of stepper (Galaxy S5 size)

这是代码:

<mat-horizontal-stepper>
  <mat-step>
    <ng-template matStepLabel>
      <ul>
        <li>
          <mat-icon>format_list_numbered</mat-icon>
        </li>
        <li fxHide.lt-sm>
          <p>Grades</p>
        </li>
      </ul>
    </ng-template>
    <app-grades></app-grades>
  </mat-step>
  <mat-step label="Student">
    <ng-template matStepLabel>
      <ul>
        <li>
          <mat-icon>account_circle</mat-icon>
        </li>
        <li fxHide.lt-sm>
          <p>Student</p>
        </li>
      </ul>
    </ng-template>
    <app-user></app-user>
  </mat-step>
  <mat-step label="Teachers">
    <ng-template matStepLabel>
      <ul>
        <li>
          <mat-icon>people</mat-icon>
        </li>
        <li fxHide.lt-sm>
          <p>Teachers</p>
        </li>
      </ul>
    </ng-template>
    <app-teachers></app-teachers>
  </mat-step>
  <mat-step label="Messages">
    <ng-template matStepLabel>
      <ul>
        <li>
          <mat-icon>message</mat-icon>
        </li>
        <li fxHide.lt-sm>
          <p>Messages</p>
        </li>
      </ul>
    </ng-template>
    <app-messages></app-messages>
  </mat-step>
</mat-horizontal-stepper>

FxLayoutModule包含在app.module.ts的导入中

FxLayoutModule is included in imports of app.module.ts

推荐答案

FlexLayoutModule必须导入所有希望使用它的模块中

FlexLayoutModule must be imported in all modules that wish to use it

import { FlexLayoutModule } from '@angular/flex-layout';
@NgModule({
  imports: [
    FlexLayoutModule,
  ]
})
export class MyModule { }

这篇关于Angular Material FlexLayout fxHide不隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 02:42