Friends, I want to send this id
that prints a ng-repeat
<p>{{ p.id }} </p>
to a factory to concatenate it in a url
http://api/products/"+paramId+"?token="
+localStorage.getItem('token')+"&user_id="+localStorage.getItem('user_id');
.factory('ProductosId',function($q, $http, $location){
var Api = {};
$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=utf-8';
Api.productosId = function() {
var defer = $q.defer();
var paramId = $location.search().idp;
var urlaux = "http://api/products/"+paramId+"?token="
+localStorage.getItem('token')+"&user_id="+localStorage.getItem('user_id');
$http({
method: 'GET',
url: urlaux,
}).success(function(data) {
defer.resolve(data);
})
return defer.promise;
}
return Api;
})
already there is done, sending it by parameters and capturing it in the factory but I want to do a method that prevents me from sending it by parameter because I will not use another view if not a modal.