我現在面臨的問題與得到的參數名稱獲取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