You need to sign in to do that
Don't have an account?
Chadwick Sakonchick
How to load static resources in Lightning Components IRL
I've seen the thread in documentation here on loading static resources using ltng:require, but I don't quite get the formatting via the example. I'm looking for some assistance to make sure what i'm doing is correct, because i'm getting an error while attempting to load these resources in the browser.
These are my files in static resources
- Resource Name: MomentJS | Filename: /moment.min.js
- Resource Name: FullCalendarCSS | Filename: /fullcalendar.css
- Resource Name: FullCalendarJS | Filename: /fullcalendar.js
- Resource Name: jQuery | Filename: /jquery.min.js
This is the code I have to attach these files to my lightning component
fullCalendar.cmp
These are my files in static resources
- Resource Name: MomentJS | Filename: /moment.min.js
- Resource Name: FullCalendarCSS | Filename: /fullcalendar.css
- Resource Name: FullCalendarJS | Filename: /fullcalendar.js
- Resource Name: jQuery | Filename: /jquery.min.js
This is the code I have to attach these files to my lightning component
fullCalendar.cmp
<aura:component controller="FullCalendarController" implements="force:appHostable"> <ltng:require styles="{!$Resource.FullCalendarCSS + '/fullcalendar.css'}" scripts="{!join(',', $Resource.FullCalendarJS + '/fullcalendar.js', $Resource.jQuery + '/jquery.min.js', $Resource.MomentJS + '/moment.min.js')}" afterScriptsLoaded="{!c.scriptsLoaded}"/> <aura:attribute name="events" type="Events[]" /> <div id="calendar"></div> </aura:component>
thanks