Static resource

* To use js file in salesforce lightning follow the below steps
Step 1: Upload the JS file in static resources
Step 2: Then call the static resource file u=into lightning by using below tag
   <ltng:require styles="/resource/myResources/styles/styles.css"
                  scripts='/resource/myResources/scripts/js1.js,
                          /resource/myResources/scripts/js2.js'
                  afterScriptsLoaded="{!c.setup}" />
 
styles : if it is custom styles then use styles type in tag.
scripts :  if it is JS file then use scripts type in tag.
afterScriptsLoaded : It is an event which is fired after the script or styles are loaded. After that we can perform any action on it.
/resource/myResources/scripts :  It is the path that the script file is located. You can save as you like.
/js1.js : This the file which we want get it.

--
Thanks And Regards,
 S.Abhinay,
Mobile: 9550337742

1 comment:

Powered by Blogger.