How to "get directions" using Google Maps in Ionic app?

Hi, I am trying to “get directions” on a Google Map in my ionic app.

On my Ionic app, I am adding some markers to a Google Map.

I want users to be able to get directions from their current location to one of the markers, in the same way you can get directions to a point with the Google Maps app.

Below is how I’m displaying a Google Map in my ionic app currently:

this.getGoogleMaps().then((googleMaps) => {
    const mapEl = this.mapElementRef.nativeElement;
    const map = new googleMaps.Map(mapEl, {
    center: this.coordinates,
    zoom: 10,

private getGoogleMaps() {
    const win = window as any;
    const googleModule =;

    if (googleModule && googleModule.maps) {
        return Promise.resolve(googleModule.maps);

return new Promise((resolve, reject) => {
    const script = document.createElement("script");
    script.src = "";
    script.async = true;
    script.defer = true;
    script.onload = () => {
        const loadedGoogleModule =;
        if (loadedGoogleModule && loadedGoogleModule.maps) {
        } else {
        reject("Google Maps SDK not available.");

Can someone please tell me how I can add this “get directions” functionality to my Ionic app?

You might want to check the Google Maps license agreement. It’s been several years since I have done so, and something may have changed in the meantime, but what you ask at least used to be explicitly prohibited in there.