You need to sign in to do that
Don't have an account?

how to add toast success message in lightning component
Hello Everyone,
I am trying to add the Toast message to the lightning Component But its not working here is the my code of the Function.
deteteQuestion : function(component, event, helper){ var action = component.get("c.delSlctRec"); var idx = event.target.id; action.setParams({ "slctRec" : idx}); var toastEvent = $A.get("e.force:showToast"); toastEvent.setParams({ title: "Success!", message: "Congrats, it works!", type: "success" }); //var result = confirm("Are you sure you want to delete?"); // if(toastEvent) { action.setCallback(this, function(response){ var state = response.getState(); if(state === "SUCCESS") { component.set("v.ques",response.getReturnValue()); toastEvent.fire(); //document.getElementById("msg").innerHTML = "Record deleted successfully"; //alert('Successfully Deleted.'); // window.location.reload(); }else if (state=="ERROR") { //console.log(action.getError()[0].message); alert('error'); } }); $A.enqueueAction(action); // } },
toastEvent.setParams({
"title": "Success!",
"message": "Congrats, it works!",
"type": "success"
});