I'm trying to create simple "database" in json file, and service for it with function to get specific item from json parsed array. I'm using sample modified code from angular tutorial:
var projectService = angular.module('projectService', ['ngResource']);
projectService.factory('Project', ['$resource', '$http',
function($resource, $http){
return $resource('assets/data/projects.json', {id: '@id'}, {
get: {
method: 'GET',
transformResponse: function(data) {
//problem
}
}
});
}]);
I see that correct parameter is passed during ajax call the whole contect of json file is returned, and I cannot access the url param to filter the array to get correct object. Is there any way to access url params in transformResponse function?