+ Start a Discussion

How to refer Angualr js file without using Static Resources ?

Hi Team, 
I am building Lightning web components, here we are using Angular js file for some validation. However, that Angualar JS lib has been stored in Google Cloud NOT in Static Resources. 
Now my questions is how to refer that Angular JS file with in Lightning components or Lightning web components ? 
To be more simple, how to refer js file which is reside outside of Salesforce ?
Deepali KulshresthaDeepali Kulshrestha
Hi Vino2Vijay
To make AngularJs functional in your lightning component you have to ensure that it is present in a static resource. To do so
follow the following steps:
1. In Setup-->Quick Find Box, type 'static resource'.
2. From the page that opens click on the new button.
3. Select your AngularJs file (download from the official website if not with you) and zip it inside a folder (Use WinRar for this).
4. In the page that opens in step 2 enter name you want to.
5. Choose the zipped folder (ensure that it is less than 5mb).
6. If it does not delete the parts that are not of your use.
7. Select public if you want to access it from other orgs too if not then leave it as private.
8. Click Save.
9. Now to use it in Lightning Component use 

        <ltng:require scripts="{!$Resource.nameYouEntered + '/YourFolderInWhichYouZippedYourAngularJsFile/NameOfFileWithExtention'}" afterScriptsLoaded="{!c.controller}"/>

10. Write whatever you want in controller.         
11. Write rest of Lightning component as it is.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha