ipsos-components
Version:
Material Design components for Angular
36 lines (32 loc) • 1.33 kB
text/typescript
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {Component, ViewEncapsulation} from '@angular/core';
import {BreakpointObserver, BreakpointState, Breakpoints} from '@angular/cdk/layout';
import {Observable} from 'rxjs/Observable';
export class ScreenTypeDemo {
isHandset: Observable<BreakpointState>;
isTablet: Observable<BreakpointState>;
isWeb: Observable<BreakpointState>;
isPortrait: Observable<BreakpointState>;
isLandscape: Observable<BreakpointState>;
constructor(private mqm: BreakpointObserver) {
this.isHandset = this.mqm.observe([Breakpoints.HandsetLandscape,
Breakpoints.HandsetPortrait]);
this.isTablet = this.mqm.observe(Breakpoints.Tablet);
this.isWeb = this.mqm.observe([Breakpoints.WebLandscape, Breakpoints.WebPortrait]);
this.isPortrait = this.mqm.observe('(orientation: portrait)');
this.isLandscape = this.mqm.observe('(orientation: landscape)');
}
}