My JSON data is structured as follows:
[
{
"id" : "1",
"type" : "hardware"
},
{
"id" : "2",
"type" : "software"
}
]
When I execute the following code:
$http({
method: 'get',
url: '/tools.json'
}).success(function(data, status, headers, config) {
///whatever
})
I retrieve these two objects for rendering using ng-repeat
, which works fine.
Now, I am looking to implement filters in my application to display only "Hardware" or "Software" items. What is the most efficient way to accomplish this? Can I directly retrieve Hardware items from the JSON itself (querying JSON and fetching matching objects)? If so, how can I achieve this? Do I need to make changes in the code to implement this functionality, or should I utilize Angular filters to render Hardware type objects after retrieving the entire JSON?
As an individual with limited experience in Angular development, I would appreciate any alternative approaches to achieve my goal.
Thank you in advance.