Skip to content

Instantly share code, notes, and snippets.

@pcote
Last active August 23, 2016 01:27
Show Gist options
  • Select an option

  • Save pcote/0af9dbbca38ec1610124ddce985405d9 to your computer and use it in GitHub Desktop.

Select an option

Save pcote/0af9dbbca38ec1610124ddce985405d9 to your computer and use it in GitHub Desktop.
var controller = function($http){
var json_args = {
num1: 5,
num2: 3
};
var showResult = function(res){
alert(res.data.sum);
}
var req = {
url: "/addnums",
method: "post",
headers: {
"Content-type": "application/json"
},
data: json_args
};
var promise = $http(req);
promise.then(showResult);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment