1
I have the following code in Angular:
<script>
angular.module("fluxo", ["ngRoute"]);
.factory('factCliente', ['$http', function($http) {
var _getData2 = function(id_empresa) {
return $http.post("php/index.php", id_empresa);
};
return {
getData2: _getData2
}
}])
.controller("fluxoCtrl", function ($scope, $http, factCliente) {
var id_empresa = {id_empresa: 1};
factCliente.getData2(id_empresa).then(function(response) {
$scope.mostraTodasContasEntradas = response;
}, function(error) {
console.log("Ocorreu um erro: " + error);
});
});
</script>
And my php code that includes the class and calls the proper function I want to call
<?php
require_once "../con/conexao.php";
require_once "../classes/contaEntrada.php";
$entrada = new contaEntrada();
$payload = json_decode(file_get_contents('php://input'));
$id_empresa = $payload->id_empresa;
$id_empresa = $_POST['id_empresa'];
$entrada->mostraContasEntrada($id_empresa);
?>
I know the error is here, in this code in php, but I do not know where. Can someone help me?
where the $_POST is?
– Marcelo Bonus
Sorry, I had already adjusted from $_GET to $_POST, but had not updated @Marcelobonus.
– GustavoSevero