title: How to check whether user has internet connection or not in Angular2?
body: <p>How I would check internet connection in Angular2 at the time of API hitting, whenever in my app API is hit to server sometimes user is
  offline (i mean without internet connection) so how would i check the internet connectivity ? is there some special status code for internet connectivity ?
  or something else ?</p>
  <p>PS:- i found <code>navigator.onLine</code> in angularJs but seems not working in angular2.</p>
  <ul>
  <li>Source - <a href="https://stackoverflow.com/a/16242703/5043867">How to check internet connection in AngularJs</a></li>
  </ul>
  <h1>update</h1>
  <p>as sudheer suggested in answer below <code>navigator.onLine</code> in working with angular2 but still not working properly why ?
  <kbd><a href="http://plnkr.co/edit/3Mw5c9DAU6d0Gnl9CtKP?p=preview" rel="noreferrer">working example here</a></kbd></p>