Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addSpotsMarkers() {
- let promises_array:Array<any> = [];
- let geocoder = new google.maps.Geocoder();
- this.spotsProvider.getSpots().subscribe((spots: Spot[]) => {
- this.spots = spots;
- this.spots.forEach((spot: Spot) => {
- promises_array.push(new Promise((resolve, reject) => {
- geocoder.geocode( { 'address': spot.address + ', ' + spot.city}, function(results, status) {
- console.log('results: ', results);
- console.log('status', status);
- if (status == google.maps.GeocoderStatus.OK) {
- resolve(results);
- } else {
- console.error(status);
- }
- });
- }));
- });
- });
- return Promise.all(promises_array);
- }
Add Comment
Please, Sign In to add comment