I can not make $ http.post in Angular, and no error is returned

2

Although it does not return an error, POST does not seem to be working.

My code:

// ADICIONA contato AO VETOR contatos
    $scope.adicionarContato = function(contato) {
      contato.data = new Date();
      // REALIZA POST EM contatos, PASSANDO contato COMO OBJETO
      $http.post("http://localhost:80/contatos", contato).then( function (successCallback) {
        delete $scope.contato; //o contato será deletado
        $scope.contatoForm.$setPristine();
        carregarContatos(); //recarrega os contatos
      }, function (errorCallback) {
        $scope.message = "Erro ao postar " + errorCallback.data;
      });
    };

Debugging in the browser seems like everything is OK with POST, however no data is passed to the file on localhost.

    
asked by anonymous 13.06.2017 / 14:18

0 answers