(AppComponent) Added missing 'is-mobile' control - Fixes: Visible scrollbars on some mobile devices

This commit is contained in:
Sercan Yemen 2018-07-12 09:24:54 +03:00
parent f45ad11861
commit 0cd5d613e0

View File

@ -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 { TranslateService } from '@ngx-translate/core';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@ -29,20 +31,24 @@ export class AppComponent implements OnInit, OnDestroy
/** /**
* Constructor * Constructor
* *
* @param {DOCUMENT} document
* @param {FuseConfigService} _fuseConfigService * @param {FuseConfigService} _fuseConfigService
* @param {FuseNavigationService} _fuseNavigationService * @param {FuseNavigationService} _fuseNavigationService
* @param {FuseSidebarService} _fuseSidebarService * @param {FuseSidebarService} _fuseSidebarService
* @param {FuseSplashScreenService} _fuseSplashScreenService * @param {FuseSplashScreenService} _fuseSplashScreenService
* @param {FuseTranslationLoaderService} _fuseTranslationLoaderService * @param {FuseTranslationLoaderService} _fuseTranslationLoaderService
* @param {Platform} _platform
* @param {TranslateService} _translateService * @param {TranslateService} _translateService
*/ */
constructor( constructor(
@Inject(DOCUMENT) private document: any,
private _fuseConfigService: FuseConfigService, private _fuseConfigService: FuseConfigService,
private _fuseNavigationService: FuseNavigationService, private _fuseNavigationService: FuseNavigationService,
private _fuseSidebarService: FuseSidebarService, private _fuseSidebarService: FuseSidebarService,
private _fuseSplashScreenService: FuseSplashScreenService, private _fuseSplashScreenService: FuseSplashScreenService,
private _fuseTranslationLoaderService: FuseTranslationLoaderService, private _fuseTranslationLoaderService: FuseTranslationLoaderService,
private _translateService: TranslateService private _translateService: TranslateService,
private _platform: Platform
) )
{ {
// Get default navigation // Get default navigation
@ -66,6 +72,12 @@ export class AppComponent implements OnInit, OnDestroy
// Use a language // Use a language
this._translateService.use('en'); 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 // Set the private defaults
this._unsubscribeAll = new Subject(); this._unsubscribeAll = new Subject();
} }