-
How to implement a custom toast message without firing a event in a Salesforce lightning component?
I have to implement a custom toast message without firing a event in a lightning component.
Log In to reply.
Activity › Forums › Salesforce® Discussions › How to implement a custom toast message without firing a event in a Salesforce lightning component?
Tagged: Aura Id, Custom Toast Message, Library, Salesforce Documentation, Salesforce Event, Salesforce Lightning Component
I have to implement a custom toast message without firing a event in a lightning component.
The correct method would be to use the lightning:overlayLibrary (or create your own modal dialog). How it works is given in the documentation. First, you include overlay library:
<lightning:overlayLibrary aura:id=”overlayLib”/>
And then you call it when you need it:
var modalBody;
$A.createComponent(“c:modalContent”, {},
function(content, status) {
if (status === “SUCCESS”) {
modalBody = content;
component.find(‘overlayLib’).showCustomModal({
header: “Application Confirmation”,
body: modalBody,
showCloseButton: true,
cssClass: “mymodal”,
closeCallback: function() {
alert(‘You closed the alert!’);
}
})
}
});
Where c:modalContent is the thing you want to show in the modal dialog. I suggest you read the documentation for more information.
Log In to reply.