0

a.cmp

<aura:component >
    //...
    <lightning:button label="looks" onclick="{!c.initDialog}" />
    //...
</aura:component> 

controller.js

initDialog: function (component, event, helper) {
  //doSomething
},
doSomething: function (component, event, helper) {
   ....//doSomething1
   var toastEvent = $A.get("e.force:showToast");
                    toastEvent.setParams({
                        type: 'info',
                        message: 'This is a required message',
                        messageTemplate: 'XXXXXXXXXXXXX{0}',
                        messageTemplateData: [{
                            url: '{!c.initDialog}',//here,I can call initDialog function!
                            label: 'here'
                        }]
                    });
                    toastEvent.fire();
   ....//doSomething2
}

In toast,Can i call "initDialog" function?

1

No. You can generate a url to another component (see lightning:navigation), but you can't generate a method call somehow.

| improve this answer | |

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.