2017-01-30 5 views
0

いくつかの値をグループ化する必要があるjson配列を入れ子にしました。グループ化のためにネストされたタグを取得できません。Angularjs:ng-repeat with groupByを使って入れ子になったjson配列値にアクセスする

$scope.sampleTest = [{"id": "1", "cash": {"amount":"4000"}}, 
        {"id": "2", "cash": {"amount":"2000"}}] 

私はその

は、誰もがこの問題を解決するために私を助けることができる

を動作していない「cash.amount」をグループ化していた場合、私は「ID」その作業とをグループ化していますか?

答えて

0

あなたが行うことができ、

<div ng-repeat="record in sampleTest | filter: {cash:{amount:'2000'}}:true "> 

DEMO

var app = angular.module('todoApp', []); 
 

 
app.controller("dobController", ["$scope", 
 
    function($scope) { 
 
    $scope.sampleTest = [{"id": "1", "cash": {"amount":"4000"}}, 
 
        {"id": "2", "cash": {"amount":"2000"}}, 
 
         {"id": "3", "cash": {"amount":"2000"}}]; 
 
    
 
    
 
    
 
    } 
 
]);
<!DOCTYPE html> 
 
<html ng-app="todoApp"> 
 

 
<head> 
 
    <title>Sample</title> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script> 
 
</head> 
 
<body ng-controller="dobController"> 
 
<div ng-repeat="record in sampleTest | filter: {cash:{amount:'2000'}}:true "> 
 
    <ul> 
 
     <li >{{ record}}</li> 
 
    </ul> 
 
</div> 
 
    
 
</body> 
 

 
</html>

関連する問題