0
<apex:page applyBodyTag="false" docType="html-5.0" showHeader="false" standardStylesheets="false">

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>

<!-- ContactMatchApp scripts -->
<apex:includeScript value="{!URLFOR($Resource.ContactMatchSPA, '/app.js')}" />
<apex:includeScript value="{!URLFOR($Resource.ContactMatchSPA, 'app/eb/ebcontroller.js')}" />


<apex:remoteObjects jsNamespace="test" >
    <apex:remoteObjectModel name="Contact" jsShorthand="ContactGateWay" fields="Name,Id,Email, AccountId"> 

    </apex:remoteObjectModel>
</apex:remoteObjects>
<div ng-app="app">
    <h1> Contact Match </h1>
    {{5 + 4}}
    <div ng-view="ng-view">

    </div>    

</div>

I'm writing some basic Angular app with Salesforce and running into an issue where the app is failing to load the script resource.

Below is what I get in the page-source,

When I see it in developer console, I'm getting an GET error (404)

GET https://c.cs60.visual.force.com/resource/1482702320000/ContactMatchSPA/app.js

Whereas app.js is loaded in static resource under the ContactMatchSPA?

What am I missing?

2
  • 5
    Case of the filename, correct path/folder?
    – Eric
    Dec 25, 2016 at 22:09
  • To debug, open the console of the browser, usually by F12. Reload the page and Then in the network, check for the angular js file. If it says, file not found, it is a path issue else it maybe something else.
    – manjit5190
    Dec 26, 2016 at 13:58

1 Answer 1

-3

Can you check the AngularJS version? I would suggest to download it from Angularjs website and create the static resource by uploading the minified and other JS scripts. The full ZIP contains. And then reference from there as you did in your code. We did the same on our project and did not encounter any issue.

One of the substantial reason of this because Google regularly updates the language and some methods and variables or properties getting changed every day.

Change these two lines;

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-route.js"></script>  
5
  • 3
    Are you saying that you think Google removes the references to these older version as new ones come out? If they did can you imagine how broken the web would be. Not sure that your assumption is the reason for the OP's issue
    – Eric
    Dec 25, 2016 at 23:50
  • Yes, I am saying that. We followed the same rule in our live project. Google is always enhancing the Library so there are high possibilities that the methods signature or the properties you are using might have changed. Dec 26, 2016 at 0:51
  • 3
    @Prilay - When you link to a specific version in a CDN it is expected that the linked version will remain in place and unified. Otherwise CDN's would ceases to exist.
    – Eric
    Dec 26, 2016 at 0:54
  • Thank you, all. It was a path issue. Apparently, I needed to include the name of the zip folder one more time in my script ref tag for SF to find it...oh well, thx for all your help.
    – JJSHHS
    Dec 27, 2016 at 5:51
  • @JJSHHS Can you post an answer highlighting what the fix was?
    – Matt Lacey
    Jan 3, 2017 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .