0

This question already has an answer here:

I am calling Component from App, in that case the Events like showToast,closeQuickAction,navigateToURL are not working.

Please find and let me know how can I resolve this

Test.app

<aura:application access="GLOBAL" extends="ltng:outApp">
   <!-- <c:Test></c:Test> -->
    <aura:dependency resource="c:Test" /> 
    <aura:dependency resource="markup://force:navigateToURL" type="EVENT"/>
    <aura:dependency resource="markup://force:closeQuickAction" type="EVENT"/>
    <aura:dependency resource="markup://force:showToast" type="EVENT"/>    
</aura:application>

Test.cmp

<aura:component controller="TestController" implements="force:lightningQuickAction,force:hasRecordId,flexipage:availableForAllPageTypes,force:appHostable" >

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/> 
....
</aura>

TestController.js

doInit : function(component, event, helper) {

    var toastEvent = $A.get("e.force:showToast");
    toastEvent.setParams({
                    title : 'Success Message',
                    message: 'TIN Validation successfully completed.', 
                    type: 'success'            
                });
    toastEvent.fire();
    $A.get("e.force:closeQuickAction").fire();               
}

marked as duplicate by Reshma, sfdcfox lightning-aura-components Jan 28 at 6:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Is your component insde lightning container? if not those events wont work – Pranay Jaiswal Jan 27 at 20:18
  • All those events you mentioned will only work in Lightning Experience (one.app container). They wont work in custom .app containers. – Nithesh N Jan 28 at 6:20
0

Your Test.cmp is missing a closing </aura:component> tag.

You wrote just </aura>

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