title: How to fetch the device name from the browser using angular2
body: <p>I have a grid list, where in it gets filled with User device details as soon as the user is logged in.
  so can anyone help me how do i fetch the device name from the browser and also i need to fetch the location of the system.</p>
  
  <p>This is the <a href="https://stackblitz.com/edit/angular-dedrza?file=src/app/app.component.ts" rel="nofollow noreferrer">Demo</a> of my code.</p>
  
  <p>Ts:</p>
  
  <pre><code> var isDeviceType = (/iPad/i).test(navigator.userAgent) ?
      "iOS" : (/iPhone/i).test(navigator.userAgent) ?
      "iOS" : (/Android/i).test(navigator.userAgent) ?
      "Android" : (/BlackBerry/i).test(navigator.userAgent) ?
      "BlackBerry" : "Browser";
    console.log(isDeviceType)
    this.isDeviceType = isDeviceType;
  </code></pre>
  
  <p>From this set of information i am able to get on which i am using my device like <code>Browser</code> but i need to fetch the name of device and i am using <code>navigator.userAgent</code> to detect browser</p>