Using Angular with Visualforce Remoting

With the rise of the Web and the HTML5, libraries like Angular , Knockout, Backbone started becoming popular. Among them somehow Angular stood out of the queue and looked more promising than others. It was also because of the fact that it is maintained by Google!

With VF pages I somehow couldn't find a good way to implement Angular, I have been tinkering with the library to make it work with Visualforce. I somehow wanted to marry Angular Factories with Visualforce Remoting and ended up doing the same using promise.

Here is small example how to use Visualforce Remoting with Angular.

Visualforce Page

<apex:page controller="AngularRemoting_Con">  
   <vs:importvisualstrap />  
   <vs:visualstrapblock >  
   <apex:includeScript value=""/>  
   <!--Remoting Stuff-->  
     function getSobjects(callback){              
         {escape: false}  
     var vfremote = angular.module('VFRemoting',[]);  
       var factory = {};  
       factory.getData = function(){  
         var deferred = $q.defer();  
         return deferred.promise;  
       return factory;  
         $ = result;  
   <div ng-app="VFRemoting">  
     <div ng-controller="VFRemoteController">  
       <ul class="list-group">  
         <li ng-repeat="acc in data" class="list-group-item">{{acc.Name}}</li>  

Controller Class

 public class AngularRemoting_Con {  
   public static List<SObject> getData(){  
     return [SELECT Id,Name FROM Account];  

How it looks like ?

A bit more about the pages

  • The pages uses VisualStrap for styling, that can be removed along with all the components starting with namespace "vs".
  • The Angularjs brings data from controller using Visualforce Remoting, it depends on "getSobjects" method to call controller method.
  • AngularJs uses Factories to communicate with remoting method "getSobject"

This page can be extended to do a lot more things, bringing data dynamically to the VF pages, with the two way binding that angular provides, you can use this to make superfast single page apps.

I am looking forward to Visualforce Remote objects and probably will be posting a blog about how to use them with AngularJS, but at the end I don't think there would be much of differences rather than some basic changes in the code structure. And obviously with Remote objects you won't need a controller!


  1. We always follow information and instructions from your website and also from online Angularjs training center which lead to success. Thanks a lot for genuine information sharing.

  2. I like your post very much. It is very much useful for my research. I hope you to share more info about this. Keep posting!!
    Best Devops Training Institute

  3. Very Nice Blog…Thanks for sharing this information with us. Here am sharing some information about training institute.
    digital transformation services by NGS


  4. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
    Hire Outsource Angular Development in India