Below is my angular code to get contact. It runs locally using nodejs.
angular.module('demoApp')
.factory('contactService', function($http, $q) {
return {
getContactDetails: function(quoteId) {
var soql = 'SELECT Name FROM Contact Limit 1;
var url = 'http://cs18.salesforce.com/services/data/v30.0/query?q=' + encodeURIComponent(soql);
var sessionId = '00D1100000BzLId!ASAAQPOKAZvD05Q1Jy71YcLdkK0Y_tGwK1bqTUcFfYLS8THKJ5DJtC2VXmrswtBWvjjp';
var deferred = $q.defer();
$http({url:url,method:'GET',headers:{'Authorization': 'OAuth ' + sessionId}}).success(function(data, status) {
deferred.resolve(data);
}).error(function(err, status) {
console.log(err);
deferred.reject(err);
});
return deferred.promise;
}
};
});
But it gives me this error
XMLHttpRequest cannot load http://cs18.salesforce.com/services/data/v30.0/query?q=SELECT%20Name%2C%20A…oposal__Proposal_Name__c%20FROM%20Apttus_Proposal__Proposal__c%20Limit%201. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
How can I fix it? Any thoughts?