6
I pass the id of the object coming from an ng-repeat through the $stateParams more later I would need to take the object of the array referring to the id coming from the URL to display the information. My doubt is whether I have to take this JSON object as I do ? And if there’s any other way to do that like sending the specific object instead of just the id ?
controller :
.controller('SingleController', function($scope,$http,$stateParams) {
$stateParams.id;
console.log($stateParams.id);
$scope.dados = Array();
$http.get("js/dados.php").success(function(data){
$scope.dados = data.dados;
console.log($scope.dados);
}).error(function(data){
alert("Error...");
console.log(data);
});
});
Your question is very confusing. You have an array of objects and want to pick up an item through an the attribute
id
of this object?– André Ribeiro
that’s right! more also if it is possible to pass the item directly to the new page instead of passing the id and then fetching the item ...
– Matheus Monteiro