0

I'm getting the following error message while attempting to save a controller that is used to navigate to a lightning page (knowledge topic) in lightning communities. Can anyone assist? Error and code are below:

Failed to save landingPageController.js: ESLINT_ERROR: {c:landingPage - CONTROLLER} line:col [10:4] --> Parsing error: Unexpected token urlEvent : Source

Controller code where error occurs:

({
    gotoURL : function (component, event, helper) {
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
            "url": "/clientserviceonline2/s/topic/0TO0Q0000008aIdWAI/popular-articles"
        }
        urlEvent.fire();
    }
})

Component code snipet:

<button class="slds-button slds-button_icon slds-button_icon-small slds-float_right slds-popover__close slds-button_icon" title="Close dialog" onclick="{!c.gotoURL}">
3

You missed a closing parenthesis:

({
    gotoURL : function (component, event, helper) {
        var urlEvent = $A.get("e.force:navigateToURL");
        urlEvent.setParams({
 //                       ^^ opening
            "url": "/clientserviceonline2/s/topic/0TO0Q0000008aIdWAI/popular-articles"
        });
//      ^^ closing (you are missing the parenthesis)
        urlEvent.fire();
    }
})
  • Thank you very much. Based on the code you see there, any reason why this event wouldn't fire? – ramtwins25 Dec 14 '18 at 0:01
  • Are you in lightning out? – Adrian Larson Dec 14 '18 at 0:59
  • No. I'm using communities with a custom component. – ramtwins25 Dec 14 '18 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.