angular-google-place icon indicating copy to clipboard operation
angular-google-place copied to clipboard

How to use it from typescript

Open psykolm22 opened this issue 7 years ago • 2 comments
trafficstars

From @mmaryo on February 3, 2017 17:19

Hello,

I would like to use it from ts like :

let res = ng2GooglePlace.locate("15 rue de la république, Paris")

can you provide a service like that ?

Copied from original issue: psykolm22/ng2-google-place-autocomplete#7

psykolm22 avatar Dec 31 '17 12:12 psykolm22

Hello,

i can provide service like it, see usage below !

ng2GooglePlaceService.getPredictions("15 rue de la république, Paris").then((response) => {this.predictions = response})

For this example, this.predictions will be populate by some Google Place Predictions based on "15 rue de la république, Paris".

Google Place Predictions are not full detailled like Google Place but for get more details based on place_id from there results, i can also provide this : ng2GooglePlaceService.getPlaceFromPlaceId(prediction).then((response) => {this.place = response})

If you have any suggestion please feel free to ask.

Ps: I just made an quick example of that usage in order to see possibilities , of course i let you imagine that finally example result can be parse like demo .

ng2-google-place-autocomplete

psykolm22 avatar Dec 31 '17 12:12 psykolm22

From @mmaryo on February 14, 2017 17:18

thanks ! It's very good solution (with typed response)

other thing, I would like to access to Address, Location, etc that are inside ng2-google-places.classes.ts, and dispite there classes are "export", I cannot use there in my code

psykolm22 avatar Dec 31 '17 12:12 psykolm22