I am not familiar with Angular js.

I have few qestions:

a) How to pass the Query param from angular js to salesforce?

b) Here with my code and it is not working.

VF Page:

<apex:page controller="angular3">
    var ngApp= angular.module('ngApp', []); 
        ngApp.controller('ContactCtrl' ,['$scope',function ($scope) {
                    function(result, event) {
                        $scope.lead = result;
                        $scope.fname = result.FirstName;

    <div class="bootstrap" ng-app="ngApp" ng-controller="ContactCtrl" >
        <h2 align="left">Create New Appointment</h2>
        <p>First name: {{fname}}</p>
        <table th="Customer Information">
                <td>First Name {{fname}} </td>
                <td>Last Name {{ lead.LastName }}</td>
                <td>Street {{ lead.street }}</td>
                <td>City {{ lead.city }}</td>
                <td>State {{ lead.state }}</td>
                <td>Zip Code {{ lead.zip }}</td>
<apex:stylesheet value="//cdn.jsdelivr.net/webjars/bootstrap-sf1/0.1.0-beta.6/css/bootstrap-namespaced.css"/>
<apex:includeScript value="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.11/angular.min.js"/>


global class angular3 {

global static Lead getLead() { //(Id LeadId) {

    return [SELECT Id, Address, City, Company, Country, Description, Email, Fax, FirstName, Name, Industry, LastName,  Latitude, LeadSource, 
    Longitude, MobilePhone, OwnerId, Phone, Rating, Salutation, State, Status, Street, title, Website, PostalCode FROM Lead where Id = '00Q4100000J6CGn'];

Please help me on this.


1 Answer 1


On b), in this case you need to notify Angular to run its digest cycle by adding:


to the end of the callback function you pass to angular3.getLead. This is because you are making the server call through Salesforce code rather than Angular's built in $http service that handles that automatically.

On a), you pass the parameters to the @RemoteAction by placing them before the callback function:

    function(result, event) {

global static Lead getLead(Id leadId) {

and you will need to have the id available in the JavaScript to pass; above I'm assuming it has been added to the scope.

(Think that the name angular3 is going to be confusing in the long term so is worth changing; this is Angular 1.x code and Angular 3 is a near future version of the framework.)

You must log in to answer this question.

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