Multiple Remoting Controllers for SPA

I am attempting to build a SPA using VF, AngularJS and numerous Custom Apex Controllers with RemoteActions. My plan was to call the Apex backend via Javascript Remoting calls wrapped in Angular Services.

I have read, and re-read through the docs and I am still a bit fuzzy on something: Do you have to explicitly inject a controller in the page component in order to use it for remoting?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1


global  class xGlobal {
    global static string doAction1( string JSONData ) {  
    return class1.doAction(JSONData );
    global static string doAction2( string JSONData ) {  
    return class2.doActionElse(JSONData );


// component

<apex:component controller="iQuoteGlobal">
    <script type="text/javascript">
 var xCorpNS = new Object();
 xCorpNS.doAction1= '{!$RemoteAction.xGlobal.doAction1}';
 xCorpNS.doAction2= '{!$RemoteAction.xGlobal.doAction2}';

In my application I have one component tied to one global class for all remote actions.
I add the component to the pages that require remote actions.

The global class methods are small and all the real work is performed in different sub classes.

Helps separate the business logic from the mechanics of configuring remote actions.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x