Activity › Forums › Salesforce® Discussions › Can we include external Library into Salesforce Lightning Component?
Tagged: Apex Library, Bootstrap, Custom CSS, Custom Javascript, Document Library, Javascript Library, JQuery, Salesforce Lightning, Salesforce Lightning Components
-
Can we include external Library into Salesforce Lightning Component?
Posted by Prachi on August 17, 2018 at 1:29 PMCan we include external Library into Salesforce Lightning Component?
Parul replied 7 years, 7 months ago 3 Members · 3 Replies -
3 Replies
-
Hi Prachi,
Yes ,we can use multiple libraries in our lightning component like JQuery, Bootstrap, custom CSS and custom Javascript libraries from a local resource (static resource).
- [adinserter block='9']
-
To reference a JavaScript library that you’ve uploaded as a static resource, use a <ltng:require> tag in your .cmp or .app markup.
The framework’s content security policy mandates that external JavaScript libraries must be uploaded to Salesforce static resources. For more information on static resources, see “Static Resources” in the Salesforce online help. -
Adding more points:
Here’s an example of using <ltng:require>.
<ltng:require scripts=”{!$Resource.resourceName}”
afterScriptsLoaded=”{!c.afterScriptsLoaded}” />
Log In to reply.