0
self.records: [
  {
    "Reg_code": 10001025,
    "Name": "Chandan Kumar Penta",
    "staticColumn": {
      "Check": "Check1",
      "HHHHH": ""
    }
  },
  {
    "Reg_code": 10001290,
    "Name": "test_B2 ",
    "staticColumn": {
      "Check": "Check2",
      "HHHHH": ""
    }
  },
  {
    "Reg_code": 10001028,
    "Name": "Ronny Lewis",
    "staticColumn": {
      "Check": "Check3",
      "HHHHH": ""
    }
  }
]

This is my JSON object. I want to sort on the basis on Check in AngularJS. Please help.

3
  • you mean you need to filter the record by check? Commented Jan 27, 2017 at 6:31
  • @Yogiraj on the basis of check means the key check in each object present in stationColumn object?? Commented Jan 27, 2017 at 6:34
  • Please check here plnkr.co/edit/S5PwRWQFmQekoPPFFpGk?p=preview Commented Jan 27, 2017 at 6:44

1 Answer 1

3

You can do,

<div class="adaptions" ng-repeat="record in records | orderBy:'staticColumn.Check' ">

DEMO

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

app.controller("dobController", ["$scope",
  function($scope) {
    $scope.records  = [
  {
    "Reg_code": 10001025,
    "Name": "Chandan Kumar Penta",
    "staticColumn": {
      "Check": "Check4",
      "HHHHH": ""
    }
  },
  {
    "Reg_code": 10001290,
    "Name": "test_B2 ",
    "staticColumn": {
      "Check": "Check2",
      "HHHHH": ""
    }
  },
  {
    "Reg_code": 10001028,
    "Name": "Ronny Lewis",
    "staticColumn": {
      "Check": "Check3",
      "HHHHH": ""
    }
  }
];
   
  
  }
]);
<!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 class="adaptions" ng-repeat="record in records | orderBy:'staticColumn.Check' ">
     <ul>
       <li >{{ record.staticColumn.Check }}</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.