Last active
November 10, 2015 18:13
-
-
Save leonardocouy/d3ac3c886859229458ab to your computer and use it in GitHub Desktop.
Send Post with $http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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