Example #1
0
 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)');
 }
Example #2
0
 ngOnInit() {
   this.breakpointObserver
     .observe([Breakpoints.XSmall, Breakpoints.Small])
     .subscribe((state: BreakpointState) => {
       this.isScreenSmall = state.matches ? true : false;
   });
 }
Example #3
0
  constructor(public media: BreakpointObserver, iconRegistry: MatIconRegistry, sanitizer: DomSanitizer, cdr: ChangeDetectorRef)  {
    iconRegistry.addSvgIconSet(sanitizer.bypassSecurityTrustResourceUrl('./../../../assets/mdi.svg'));

    media.observe('(max-width: 599px)').subscribe( isMatched => {
      this.isMediaSmall = isMatched.matches;
      cdr.markForCheck();
    });
  }