0

I've nested json array in which i need to group with some values. I'm not able to fetch nested tag for grouping.

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

If i'm grouping 'id' its working and if i'm grouping 'cash.amount' its not working

Can anyone help me to solve this issue?

1 Answer 1

0

You can do,

<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>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.