Skip to content
Snippets Groups Projects
app.service.ts 813 B
Newer Older
  • Learn to ignore specific revisions
  • @Injectable({
        providedIn: 'root'
    })
    
    export class AppService {
    
    
        private _mobileQueryListener: () => void;
        mobileQuery: MediaQueryList;
    
        constructor() {
            /*this.mobileQuery = media.matchMedia('(max-width: 768px)');
    
            this._mobileQueryListener = () => changeDetectorRef.detectChanges();
    
            this.mobileQuery.addListener(this._mobileQueryListener);*/
    
            if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
    
                return true;
            } else {
                return this.mobileQuery.matches;
            }
        }
    
    
            this.mobileQuery.removeListener(this._mobileQueryListener);