Creating angular 2 service to work with Google Places API Web Service to get address

In the recent projects I have worked on, I had the requirement to create a address auto look up feature. This is a common requirement these days, people prefer to have address auto completion as it easy to make mistakes by typing it manually. In my case I decided to go with Google Places API Web Service. Since I have worked in the past with google web services, I know how easy it is to implement.

I wrote google.places.service.ts  service in in my Angular app to call API and return the list of address matching what user have typed.

yep, its that easy.

I am using to ng2-bootstap typeahead, in this sample. below is the html

This is how the Angular component code looks like.

Leave a comment