• Renuka kamble 10
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I am trying to open another component on click of button but i am getting error as "Cannot read property 'newComponentAsync' of undefined".

Below is my code-

Component-
<button class="slds-button slds-button--neutral" onclick="{!c.gotoURL}">Open Another Component</button>

Controller-
gotoURL : function(component, event, helper) {
        var destination ="markup://c:SampleComponent";
        $A.componentService.newComponentAsync(this,
            function(view) {
              var content = component.find("content");
              content.set("v.body", view);
              }, 
              {
                 componentDef: destination,
                          }, component);
    }

Please help.