2017-05-31 137 views
0

當我使用這個對象離子2

this.nativeGeocoder.reverseGeocode(parseFloat(this.myLat),parseFloat(this.myLong)) 
    .then((result: NativeGeocoderReverseResult) => 
    { console.log('The address is ' + result.street + ' in ' + result.countryCode) 
在稱爲在構造我是getting-

地址爲無名路IN 結果函數

.street不工作 !

回答

0

您必須更新result.street導致[0] .street 它將工作

this.nativeGeocoder.reverseGeocode(parseFloat(this.myLat),parseFloat(this.myLong)) 
    .then((result: NativeGeocoderReverseResult) => 
    { console.log('The address is ' + result.street + ' in ' + result.countryCode) 

this.nativeGeocoder.reverseGeocode(parseFloat(this.myLat),parseFloat(this.myLong)) 
    .then((result: NativeGeocoderReverseResult) => 
    { console.log('The address is ' + result[0].street + ' in ' + result[0].countryCode)