How to use the ngx-device-detector.DeviceDetectorService function in ngx-device-detector

To help you get started, we’ve selected a few ngx-device-detector examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github KoderLabs / ngx-device-detector / .playground / index.js View on Github external
function AppComponent(deviceService) {
        this.deviceService = deviceService;
        this.propsToShow = ["userAgent", "os", "browser", "device", "os_version", "browser_version"];
        this.device = null;
        this.device = deviceService.getDeviceInfo();
        console.log(this.device);
        console.log('isMobile', this.deviceService.isMobile());
        console.log('isTablet', this.deviceService.isTablet());
    }
    var _a;
    AppComponent = __decorate([
        core_2.Component({
            selector: 'app',
            template: "\n  <div class="\&quot;container\&quot;" id="\&quot;demoApp\&quot;">\n    <div class="\&quot;demo-container\&quot;">\n      <div class="\&quot;demo-heading\&quot;">\n        <h2 class="\&quot;text-center">\n          ngx-device-detector demo\n        </h2>\n        <p class="\&quot;text-center\&quot;">\n          Open this page from different devices to see the appropriate details\n        </p>\n        <h4 class="\&quot;text-center\&quot;">Device Information</h4>\n      </div>\n      <div class="\&quot;information-table\&quot;">\n        \n          \n            \n            \n          \n          \n            \n            \n          \n        <table class="\&quot;table"><tbody><tr><th>Property</th><th>Value</th></tr><tr class="\&quot;info-item"><td>{{info.key}}</td><td>{{info.value}}</td></tr></tbody></table>\n      </div>\n    </div>\n  </div>\n"
        }),
        __metadata("design:paramtypes", [typeof (_a = typeof ngx_device_detector_1.DeviceDetectorService !== "undefined" &amp;&amp; ngx_device_detector_1.DeviceDetectorService) === "function" ? _a : Object])
    ], AppComponent);
    return AppComponent;
}());
var AppModule = /** @class */ (function () {

ngx-device-detector

<p align="center"> <img src="https://raw.githubusercontent.com/AhsanAyaz/ngx-device-detector/master/assets/logo.svg" width="200"> </p>

MIT
Latest version published 5 months ago

Package Health Score

75 / 100
Full package analysis