我现在面临的问题与得到的参数名称获取JSON对象节点数在角JS
在下面的JSON具有特定值的JSON对象的计数我想获得具有数名:正在为你能帮我让我知道这里出了什么问题。下的问题>领域>状态
名称参数存在
JSON数据
{
"expand": "schema,names",
"startAt": 0,
"maxResults": 50,
"total": 257,
"issues": [
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "1579217",
"fields": {
"created": "2017-08-11T13:03:52.000+0000",
"resolutiondate": null,
"status": {
"name": "IN PROGRESS",
"id": "3"
}
}
},
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "1578077",
"fields": {
"created": "2017-08-10T13:14:53.000+0000",
"resolutiondate": null,
"status": {
"name": "IN PROGRESS",
"id": "10548"
}
}
},
{
"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
"id": "1562078",
"fields": {
"created": "2017-07-27T03:42:24.000+0000",
"resolutiondate": null,
"status": {
"name": "To Do",
"id": "10548"
}
}
}
]
}
角JS
var app = angular.module('myApp', ['angular-loading-bar']);
app.controller("Controller", ["$scope", "$http", "$filter", "$window",
function($scope, $http, $window, $filter) {
$scope.findTheValue = function() {
$http({
method: 'POST',
url: 'issues.json'
}).then(function(response) {
$scope.selectedCount = $filter('filter')(response.issues, {
name: 'IN PROGRESS'
}).length;
console.log($scope.selectedCount);
})
}
}
]);
感谢@Vivz像魅力一样工作 – Batman