Skip to content

Instantly share code, notes, and snippets.

@leonardocouy
Last active November 10, 2015 18:13
Show Gist options
  • Save leonardocouy/d3ac3c886859229458ab to your computer and use it in GitHub Desktop.
Save leonardocouy/d3ac3c886859229458ab to your computer and use it in GitHub Desktop.
Send Post with $http
var app = angular.module('AppExemplo', [])
app.controller('ExemploController', function($scope, $http) {
var data = $.param({
nome: $scope.nome,
idade: $scope.idade,
});
$scope.cadastrarUsuario = function(){
$http.post("http://sitedoallif/api/usuarios/", data).success(function(data, status) {
$scope.response = data
console.log($scope.response)
}).error(function(data,status){
console.log(data)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment