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 code in php that includes the class and calls the appropriate function that 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 that code in php, but I do not know where. Can anyone help me?