Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- <div>This component checks static resource loading on Init</div>
- {!v.body}
- </aura:component>
- ({
- doInit : function(cmp, event, helper) {
- $A.createComponent(
- "ltng:require",
- {
- "scripts": "/community/resource/loadMe.js"
- },
- function(newButton, status, errorMessage){
- //Add the new button to the body array
- if (status === "SUCCESS") {
- var body = cmp.get("v.body");
- body.push(newButton);
- cmp.set("v.body", body);
- }
- 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
- }
- }
- );
- }
- }
- })
- <aura:component implements="forceCommunity:availableForAllPageTypes" access="global" >
- <ltng:require scripts="{!$Resource.loadMe}"/>
- <div>This component checks static resource loading on Init</div>
- {!v.body}
- </aura:component>
- $A.createComponent(
- "ltng:require",
- {
- "scripts": $A.get("$Resource.loadMe")
- },
Add Comment
Please, Sign In to add comment