简体   繁体   中英

angular-material2 responsive show/hide

Is it possible to control visibility of element with angular-material2 using

hide-xx  show-xx hide-gt-xx show-gt-xx

i know this is working with angularJS-material.
Code below does not work:

<md-toolbar color="primary">
  <span>Application Title</span>  
  <span class="example-fill-remaining-space"></span>
  <button md-button hide-xs show-gt-xs>Auto hide button</button>  
</md-toolbar>

I use https://github.com/angular/material2 version 2.0.0-beta1

If No, if there is another way to do that without using *ngif and screen resize listeners, or other css frameworks like Bootstrap ?
Also does https://github.com/angular/flex-layout has this possibility by the way?

I would recommend @angular/flex-layout , as you already mentioned!

It's an additional package - installation needed, it's not a part of angular!

Possible options:

  • fxHide
  • fxHide.xs
  • fxHide.gt-xs
  • fxHide.sm
  • fxHide.gt-sm
  • fxHide.md
  • fxHide.gt-md
  • fxHide.lg
  • fxHide.gt-lg
  • fxHide.xl

Usage:

<div fxFlex="60" fxHide.xs></div>

live-demo: https://plnkr.co/edit/yrhaGtFpHOlYYOTqzDDO?p=preview

documentation here:

https://github.com/angular/flex-layout/wiki/API-Documentation

https://github.com/angular/flex-layout/wiki/fxShow-API

https://github.com/angular/flex-layout/wiki/fxHide-API

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM