populateInfoWindow(marker, infowindow) {
        if (infowindow.marker != marker) {
            this.map.panTo(new window.google.maps.LatLng(marker.position.lat(), marker.position.lng()));
            marker.setAnimation(window.google.maps.Animation.BOUNCE);
            infowindow.marker = marker;
            setTimeout(function () {
                marker.setAnimation(null);
            }, 2000);
            infowindow.setContent('<div>Loading..</div>');
            infowindow.open(this.map, marker);
            infowindow.addListener('closeclick', function () {
                infowindow.marker = null;
            });
        }

        //Using Fetch to get data about the location
        FoursquareApi.requestFoursqureApi(marker.position.lat(), marker.position.lng()).then((response) => {
            console.log(response);
            if (response.response.venues.length > 0) {
                var venue = response.response.venues[0];
                var restName = "";
                var restPhone = "";
                var restAddress = "";
                if (venue.name) {
                    restName = venue.name;
                }
                if (venue.location && venue.location.formattedAddress && venue.location.formattedAddress.length > 0) {
                    restAddress = venue.location.formattedAddress[0];
                }
                if (venue.contact && venue.contact.phone) {
                    restPhone = venue.contact.phone;
                }
                infowindow.setContent('<div><div><strong>Name: ' + restName + '</strong></div><div>Address: ' + restAddress + '</div><div>Phone: ' + restPhone + ' </div></div>');
            }

        }).catch(function (err) {
            infowindow.setContent('<div><strong>Can Not Load Data</strong></div>');
        });;
    }
//show popup window with data from FourSquareAPI
show popup window with data from FourSquareAPI
show popup window with data from FourSquareAPI
populateInfoWindow(marker, infowindow) {
        if (infowindow.marker != marker) {
            this.map.panTo(new window.google.maps.LatLng(marker.position.lat(), marker.position.lng()));
            marker.setAnimation(window.google.maps.Animation.BOUNCE);
            infowindow.marker = marker;
            setTimeout(function () {
                marker.setAnimation(null);
            }, 2000);
            infowindow.setContent('<div>Loading..</div>');
            infowindow.open(this.map, marker);
            infowindow.addListener('closeclick', function () {
                infowindow.marker = null;
            });
        }
        FoursquareApi.requestFoursqureApi(marker.position.lat(), marker.position.lng()).then((response) => {
            console.log(response);
            if (response.response.venues.length > 0) {
                var venue = response.response.venues[0];
                var restName = "";
                var restPhone = "";
                var restAddress = "";
                if (venue.name) {
                    restName = venue.name;
                }
                if (venue.location && venue.location.formattedAddress && venue.location.formattedAddress.length > 0) {
                    restAddress = venue.location.formattedAddress[0];
                }
                if (venue.contact && venue.contact.phone) {
                    restPhone = venue.contact.phone;
                }
                infowindow.setContent('<div><div><strong>Name: ' + restName + '</strong></div><div>Address: ' + restAddress + '</div><div>Phone: ' + restPhone + ' </div></div>');
            }
        }).catch(function (err) {
            infowindow.setContent('<div><strong>Can Not Load Data</strong></div>');
        });;
    }
populateInfoWindow ( marker , infowindow ) { if ( infowindow . marker != marker ) { this . map . panTo ( new window . google . maps . LatLng ( marker . position . lat ( ) , marker . position . lng ( ) ) ) ; marker . setAnimation ( window . google . maps . Animation . BOUNCE ) ; infowindow . marker = marker ; setTimeout ( function ( ) { marker . setAnimation ( null ) ; } , 2000 ) ; infowindow . setContent ( '<div>Loading..</div>' ) ; infowindow . open ( this . map , marker ) ; infowindow . addListener ( 'closeclick' , function ( ) { infowindow . marker = null ; } ) ; } FoursquareApi . requestFoursqureApi ( marker . position . lat ( ) , marker . position . lng ( ) ) . then ( ( response ) => { console . log ( response ) ; if ( response . response . venues . length > 0 ) { var venue = response . response . venues [ 0 ] ; var restName = "" ; var restPhone = "" ; var restAddress = "" ; if ( venue . name ) { restName = venue . name ; } if ( venue . location && venue . location . formattedAddress && venue . location . formattedAddress . length > 0 ) { restAddress = venue . location . formattedAddress [ 0 ] ; } if ( venue . contact && venue . contact . phone ) { restPhone = venue . contact . phone ; } infowindow . setContent ( '<div><div><strong>Name: ' + restName + '</strong></div><div>Address: ' + restAddress + '</div><div>Phone: ' + restPhone + ' </div></div>' ) ; } } ) . catch ( function ( err ) { infowindow . setContent ( '<div><strong>Can Not Load Data</strong></div>' ) ; } ) ; ; }
show popup window with data from FourSquareAPI
show popup window with data from FourSquareAPI
//Using Fetch to get data about the location