I need help filtering the $routeParams of the data retrieved from a JSON file. Here is my current code snippet:
function PostDetailController($scope, $routeParams, $http) {
$http.get('json/posts.json').success(function(data){
$scope.photo = data;
});
}
Can someone show me how to filter the id based on the URL provided? Below is an example of what my JSON data looks like:
{
"id": 1,
"name": "details1",
"title": "Test Title",
"description": "Sample Description",
"image": "img/1.jpg",
"tags": ["photo", "internet"],
"user": "hilarl",
"comments": ["sample comment"],
"likes": 23,
"dislikes": 100,
"resolution": { "x": 150, "y": 58 }
},
{
"id": 2,
"name": "details2",
"title": "Test Title",
"description": "Sample Description",
"image": "img/2.jpg",
"tags": ["photo", "internet"],
"user": "hilarl",
"comments": ["sample comment"],
"likes": 23,
"dislikes": 100,
"resolution": { "x": 150, "y": 58 }
}