Postal_code in Ionic Framework?

Hi ,
I am using Ionic framework to develop application ,getting problem in to receive Postal code of location. So help me in this regards How to get Postal Code using google api in Ionic Framework?. In advance thank you.

Thanks & Regards,
Aruna

Hi, @arunaraj

Add ionic Native Geocoder plugin in your app for get postal_code,

ionic cordova plugin add cordova-plugin-nativegeocoder

npm install --save @ionic-native/native-geocoder

Now, add this plugin in app.module file,

import { NativeGeocoder } from '@ionic-native/native-geocoder';

@NgModule({
    ......
    providers: [
        NativeGeocoder
    ]
    ......
})
export class AppModule {}

Now, you add this code in component file,

import { NativeGeocoder, NativeGeocoderReverseResult, NativeGeocoderForwardResult } from '@ionic-native/native-geocoder';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
     constructor(private nativeGeocoder: NativeGeocoder) { }

     getPostalCode(){
          this.nativeGeocoder.reverseGeocode(<latitude>, <longitude>)
         .then((result: NativeGeocoderReverseResult) => console.log(JSON.stringify(result)))
         .catch((error: any) => console.log(error));
     }
}

Thanks.