I have a lightning component which I am using for quickaction and I currently show an error message which is passed from the controller as a String. The problem is, I want to show the error message in multiple lines instead of a single line. Below is the relevant code for the same:
var action2 = component.get("c.callfun");
action2.setParams({"accId" : recId});
action2.setCallback(this, function(response) {
var state = response.getState();
errMsgs = response.getReturnValue();
var errmsg= new Array();
errmsg = errMsgs.toString().split(".");
//alert(errmsg);
var i;
resultsToast.setParams({
"title": "Error",
"message": errMsgs
});
resultsToast.fire();
var dismissActionPanel = $A.get("e.force:closeQuickAction");
dismissActionPanel.fire();
});
$A.enqueueAction(action2);
the sample error message being returned from my apex controller is "this is a test error. this is another error. this could be the last error." - basically each being separated by a full stop (".") - Hence I was trying to split the same which again didnt yield any results.
Is there any way to display these in separate lines in the toast window - possibly with a bullet point or something?
for(i=0;i<errmsg.length;i++){ resultsToast.setParams({ "title": "Error", "message": errmsg[i]+"" }); } resultsToast.fire();