This is my Angular code:
<script>
angular.module("fluxo", ["ngRoute"]);
angular.module("fluxo").config(function ($routeProvider) {
$routeProvider.when("/entradas", {
templateUrl: "views/entradas.html",
controller: "fluxoCtrl"
})
.when("/saidas", {
templateUrl: "views/saidas.html",
controller: "fluxoCtrl"
})
.otherwise({redirectTo: "/index"});
})
.factory('pegaContas', ['$http', function($http) {
var _getContas = function(id_empresa) {
return $http.post("php/index.php", id_empresa);
};
return {
getContas: _getContas
}
}])
.controller("fluxoCtrl", function ($scope, $http, pegaContas) {
//var id_empresa = {id_empresa: id_empresa};
var id_empresa = {id_empresa: 1};
pegaContas.getContas(id_empresa).then(function(data) {
$scope.mostraTodasContasEntradas = data;
console.log(data);
}, function(error) {
console.log("Ocorreu um erro: " + error);
});
});
</script>
And this is my HTML page, where the data should appear:
<div class="container">
<div class="col-md-3">
<table class="table table-striped">
<tr>
<th>Data</th>
<th>Categoria</th>
<th>Subcategoria</th>
<th>Valor</th>
<th>Forma pgto.</th>
<th>Editar</th>
<th>Excluir</th>
</tr>
<tr ng-repeat="conta in contas">
<td>{{conta.data}}</td>
<td>{{conta.categoria}}</td>
<td>{{conta.subcategoria}}</td>
<td>{{conta.valor}}</td>
<td>{{conta.forma_pagamento}}</td>
<td></td>
<td></td>
</tr>
</table>
</div>
</div>
And yes, I have already tested and the data is coming from the bank.