Skip to content

Instantly share code, notes, and snippets.

@yuval23
Created January 20, 2019 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuval23/af74457c28933a54536d98c3f5774f6c to your computer and use it in GitHub Desktop.
Save yuval23/af74457c28933a54536d98c3f5774f6c to your computer and use it in GitHub Desktop.
Create a Dynamic component
doCreateComponent: function(component, compName, compParameters ,divId){
let namespace = 'c:'+compName;
$A.createComponents([
[namespace,compParameters]],
function(components, status, errorMessage){
if (status === "SUCCESS") {
var comp = components[0];
var compDiv = component.find(divId);
compDiv.set("v.body", comp);
}
else if (status === "INCOMPLETE") {
console.log("No response from server or client is offline.")
// Show offline error
}
else if (status === "ERROR") {
console.log("Error: " + errorMessage);
// Show error message
}
}
);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment