1

My zip file name is APIAI, it contains ApiAi.js.

Path for that file is /APIAI/ApiAi.js

I have uploaded it as static resource with name as chatbotApi and referring it in lightning component as follows:

<aura:component >
<ltng:require scripts="{!$Resource.chatbotApi + '/APIAI/ApiAi.js'}" 
    afterScriptsLoaded="{!c.toggleScript}"/>
</aura:component>     

and my component js looks like:

({
    toggleScript : function(component, event, helper) {
        console.log('hi');
    }
})

Problem is script is getting loaded but not in my domain but its under no domain section. Also script is getting enclosed under some function as you can see in image below

enter image description here

My domain is deployed. I tried changing the org but same problem.

Edit 1: error was not related to my component below is updated screenshot

enter image description here

  • 2
    Are you getting any error in the browser console? (As per the screenshot there is, what are they? Related to this?) Also, are you sure the js file which you're using is strict mode compliant? (Otherwise there's a greater probability that you might run into Locker Service issues.) – SE_User Aug 24 '17 at 9:02

Your Answer

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

Browse other questions tagged or ask your own question.