我有一个JSON文件,其中包含一些我想在AngularJS网站上访问的数据.现在我只想从数组中得到一个对象.所以我想要一个id为1的项目.
数据如下所示:
{ "results": [
{
"id": 1,
"name": "Test"
},
{
"id": 2,
"name": "Beispiel"
},
{
"id": 3,
"name": "Sample"
}
] }
I d like to load the data with AngularJS $http functionality like this:
$http.get("data/SampleData.json");
这是有效的.但是我现在如何从我从$http.get
获得的数组中获得特定的数据对象(通过id)?
Thanks in advance for your help.
问候