I have an static resource name CustomHelperJS, which is a javascript and is public. In my application i have this :

 <aura:application access="GLOBAL" extends="ltng:outApp" >
     <ltng:require styles="{!$Resource.SLDS202_HV1 + '/assets/styles/salesforce-lightning-design-system.min.css'}"
              scripts="{!$Resource.CustomHelperJS}" />

   <aura:dependency resource="c:LC01_GeneratePlainLayout"/>

when I include this app in my vf page and load it, the css apply well, but i obtain an error on my page :

   Uncaught TypeError: Cannot read property 'apply' of undefined throws at https://xxxoffice--agsdev--c.cs5.visual.force.com/auraFW/javascript/S8McHzEoUFAXrY8PUJ5Khw/aura_prod.js:499:85

My js file has not been loaded. I cannot refer to any js method i defined in that file. It gives me error, stating that the method does not exist.

Has anyone encounter problems with referencing a js file stored as a single static resource in lightning components ?

  • Does your component run properly in a standalone app? – Praveen Aug 11 '16 at 15:54

I got it to load correctly. In fact it loaded my JS file correctly , but my JS file started with the script tag inside it. So the lightning component didn't like it :

 <script type="text/javascript"> 
  • i can't accept it right now....i only can tomorrow... – vanessen Aug 12 '16 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.