O'Reilly logo
  • Stijn Dreezen thinks this is interesting:

geolocation.getCurrentPosition().then(pos => {

From

Cover of Mobile App Development with Ionic 2, 1st Edition

Note

I guess:
if (loc === undefined) {

should be added before, to make it valid if-then-else