In typescript working with angular 6,
i needed to make a async function which respond with current countryCode based on users geoLocation.
So here I am using nevigator get the current lat lng.
Its not possible to get the country code directly from nevigator. SO i needed googleMapsApi
By using import { MapsAPILoader } from ‘@agm/core’;
I am able to get the address_components from google responce and filtering it to get the current country Short name.
This is a am going to use in
ng2TelInput =>
which is used to add dial code in phone number but requires country code to auto populate.

See the GITHUB:

Make an service with async method.