Reputation: 13
How can I determine mobile browser using AngularJS? We can detect the browser using JavaScript, just wondering Angular has a different way to detect browser or device.
Upvotes: 0
Views: 5633
Reputation: 432
Depending on the version of angular:
If in Angular 1 you can use the $window object.
That object is gone in Angular 2, however, but there is also ng-device-detector which works on Angular 2 and does a decent job at getting device, OS, and browser info.
I would just use pure JS or third party library specifically made for this function. Angular is not meant to replace JavaScript or web/browser APIs, when you try to use angular in unintended ways you often run into trouble.
Upvotes: 1
Reputation: 857
you can use "ng-device-detector" in AngularJS
reference : here
ngDeviceDetector is a library which help detect the OS, browser and device in AngularJS application with ease.
Upvotes: 0