I followed the documentation example to implement a fetch method.
It works well as far as I add ?format=json
to $scope.url
.
$scope.method = 'GET';
$scope.url = "/activite/273/usagers?format=json";
$scope.fetch = function($event) {
$scope.code = null;
$scope.response = null;
$http({method: $scope.method, url: $scope.url, cache: $templateCache}).
success(function(data, status) {
$scope.status = status;
$scope.users = data;
$scope.search.status = $scope.userStatus;
$('#UserList').modal('show');
}).
error(function(data, status) {
$scope.response = data || "Request failed";
$scope.status = status;
$scope.userStatus = '';
});
$event.preventDefault();
};
Any idea ?
According to the API documentation, it looks like you should be passing parameters in a separate params
object any way. So:
$scope.method = 'GET';
$scope.url = "/activite/273/usagers";
$scope.params = {
format: 'json
};
It was in fact a problem due to json format itself, all the "
was replaced by "e;
. I fixed that and it solved the problem.