0

I have an appEvent on a child controller to update a parent method after a toast. I have set an alert on the parent in the parent method to figure out if my event is working properly. My alert shows up before the toastEvent. How can I trigger my appEvent after the toastEvent.

Controller:

else {

            var toastEvent = $A.get("e.force:showToast");
            toastEvent.setParams({
                "title": "",
                "message": "Please fill all the required fields with the red asterisks",
                type:"error",
            });
            toastEvent.fire(); 

            var appEvent = $A.get("e.c:ContinueOrStop");                 
            appEvent.setParams({
                "currentStep" : "2" });                                
            appEvent.fire();
        } 

Parent controller:

   var update = event.getParam("currentStep"); 

     if(update == "2" ){
         alert("MOVE")
         component.set("v.currentStep", "2");
     }
1

You might be able to simply listen to the toast event like you listen to any other event and chain your actions.

<aura:handler event="force:showToast" action="{!c.handleApplicationEvent}"/>
| 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.