I have the following array:
$scope.arreglo = [
{"clave_acceso":"122"},
{"clave_acceso":"222"},
{"clave_acceso":"333"}
];
and from the desire to create a url which should be like the following: If the fix has a data: http: services / authorizations? Ca = 122 If the fix has more than one data: http: services / authorizations? Ca = 122 & ca = 222 & ca = 33 ....... etc
in my controller I have the following:
$scope.url ="";
$scope.arreglo = [
{"clave_acceso":"122"},
{"clave_acceso":"222"},
{"clave_acceso":"333"}
];
for(var i =0; i < $scope.arreglo.length;i++){
if($scope.arreglo.length >= 2){
$scope.url="http:services/autorizaciones?ca="+$scope.arreglo[i].clave_acceso+"&ca="+$scope.arreglo[i].clave_acceso;
}else{
$scope.url="http:services/autorizaciones?ca="+$scope.arreglo[i].clave_acceso;
}
}
and at the end of everything I print in my html view the url
<h5>{{url}}</h5>
But something I'm doing wrong that does not appear as I expect.
How can I solve it? I thank you in advance