Skip to content
Snippets Groups Projects
device.service.ts 419 B
Newer Older
import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class DeviceService {
  hasHardwareKeyboard: boolean = false;
  private readonly isTouch!: boolean;
    this.isTouch = ('ontouchstart' in window) || (navigator && navigator.maxTouchPoints > 1);

  get isMobileWithoutHardwareKeyboard(): boolean {
    return this.isTouch && !this.hasHardwareKeyboard;