0

I am designing a lightning community page using lWC. I have this code where the user will get directed to google maps when clicked. I can see the correct value being generated when I log the address to the console. Additionally, clicking the link in the console successfully navigates to Google Maps. What could be the reason for it not navigating on the lightning page?

Here is the HTML -

<div class="slds-p-around_x-small workorder-incident-location-title-style">
     <p>{selectedWorkOrderRecord.incidentLocation}</p>
     <a href="javascript:void(0);" data-value={selectedWorkOrderRecord.googleMapsUrl}
                                    onclick={viewOnGoogleMaps} target="_blank">View on Google Maps</a>
</div>

Here is the JS -

viewOnGoogleMaps(event) {
    const googleMapsUrl = event.currentTarget.dataset.value;
    this[NavigationMixin.Navigate]({
        type: "standard__webPage",
        attributes: {
            url: googleMapsUrl
        }
    });
}

Also the same thing happens when i add the show-footer attribute to lightning-map component.

1 Answer 1

1

Did you include the following in your LWC's JS file?

import { NavigationMixin } from 'lightning/navigation';

and

export default class CLASSNAME extends NavigationMixin(LightningElement){

1
  • Yes they are all included
    – sumchans
    Commented Sep 24 at 18:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .