ng-browser-detector

4.0.3 • Public • Published

ng-browser-detector Tests

A simple angularJs service to detect platform, browser and version.

live demo here

Getting Started

Installation

You can directly clone/download here

git clone https://github.com/sibiraj-s/ng-browser-detector.git

or use cdn

Minified:

//cdn.jsdelivr.net/npm/ng-browser-detector@latest/ng-browser-detector.min.js

Pretty Printed:

//cdn.jsdelivr.net/npm/ng-browser-detector@latest/ng-browser-detector.js

or

Install via Package managers such as npm or yarn

npm install browser-dtector
npm install ng-browser-detector

# or

yarn add browser-dtector
yarn add ng-browser-detector

Usage

Import the modules required for ng-browser-detector.

<script src="angular.min.js"></script>
<script src="browser-dtector.umd.min.js"></script>
<script src="ng-browser-detector.min.js"></script>

add ngBrowser dependency to the module

const app = angular.module('myApp', ['ngBrowser']);

in routes config

function BrowserDetectController($scope, appBrowser) {
  $scope.appBrowser = appBrowser;
}

app.controller('BrowserDetectController', ['$scope', 'appBrowser', BrowserDetectController]);

to get platform

appBrowser.getPlatformName();

refer https://github.com/sibiraj-s/browser-dtector#api for more info

A simple directive is included (usage : optional)

<body browser-detector></body>

the directive appends the browser details to element's class, if provided browser-detector="attr" then the details are added as attributes

Package Sidebar

Install

npm i ng-browser-detector

Weekly Downloads

18

Version

4.0.3

License

MIT

Unpacked Size

18.5 kB

Total Files

8

Last publish

Collaborators

  • sibiraj-s