I'm setting a controller
where one of the features is to get a data in the bank through its id. However, nothing appears on the console when I put this
Code that shows the countries on the screen
<table width="200">
<tr>
<td><b>País</b></td>
<td><b>Sala</b></td>
</tr>
<tr ng-repeat="pais in paises">
<td>{{pais.nome}}</td>
<td>{{pais.sala}}</td>
<td><a href="#/editarPais/{{pais.idPais}}">editar</a></td>
</tr>
</table>
html code
<form>
<input type="hidden" ng-model="pais.idPais">
País <input type="text" ng-model="pais.nome">
Sala <input type="text" ng-model="pais.sala">
<button ng-click="atualizarPais(pais)">Atualizar</button><br>
</form>
Agile code
app.controller("PaisesController", function ($scope, $http, $routeParams, $state) {
var carregaPaises = function () {
$http.get("admin/php/pegaPaises.php").success(function (data){
//console.log(data);
$scope.paises = data;
});
};
$scope.adicionaPais = function (pais) {
$http.post("admin/php/adicionaPais.php", pais).then(function (data){
//console.log(data);
carregaPaises();
})
};
var carregaPais = function (pais) {
console.log($routeParams.pais);
};
carregaPaises();
carregaPais();
});
Config code:
var app = angular.module("vc", ["ui.router", "ngRoute"]);
.state("paises", {
url: "/paises",
controller: "PaisesController",
templateUrl: "admin/views/paises.html"
})
.state("editarPais", {
url: "/editarPais/:idPais",
controller: "editarPaisController",
templateUrl: "admin/views/editarPais.html"
})
How do I see the data that comes in the parameter?