From 0cd5d613e0ae3883f747fd6b28c88e7db6d80df3 Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Thu, 12 Jul 2018 09:24:54 +0300 Subject: [PATCH] (AppComponent) Added missing 'is-mobile' control - Fixes: Visible scrollbars on some mobile devices --- src/app/app.component.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3ecf2134..bcfc2e09 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,6 @@ -import { Component, OnDestroy, OnInit } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; +import { DOCUMENT } from '@angular/common'; +import { Platform } from '@angular/cdk/platform'; import { TranslateService } from '@ngx-translate/core'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; @@ -29,20 +31,24 @@ export class AppComponent implements OnInit, OnDestroy /** * Constructor * + * @param {DOCUMENT} document * @param {FuseConfigService} _fuseConfigService * @param {FuseNavigationService} _fuseNavigationService * @param {FuseSidebarService} _fuseSidebarService * @param {FuseSplashScreenService} _fuseSplashScreenService * @param {FuseTranslationLoaderService} _fuseTranslationLoaderService + * @param {Platform} _platform * @param {TranslateService} _translateService */ constructor( + @Inject(DOCUMENT) private document: any, private _fuseConfigService: FuseConfigService, private _fuseNavigationService: FuseNavigationService, private _fuseSidebarService: FuseSidebarService, private _fuseSplashScreenService: FuseSplashScreenService, private _fuseTranslationLoaderService: FuseTranslationLoaderService, - private _translateService: TranslateService + private _translateService: TranslateService, + private _platform: Platform ) { // Get default navigation @@ -66,6 +72,12 @@ export class AppComponent implements OnInit, OnDestroy // Use a language this._translateService.use('en'); + // Add is-mobile class to the body if the platform is mobile + if ( this._platform.ANDROID || this._platform.IOS ) + { + this.document.body.className += ' is-mobile'; + } + // Set the private defaults this._unsubscribeAll = new Subject(); }