Example for stackoverflow. Underscore

HTML

<script src="https://cdn.rawgit.com/Stepan-Kasyanenko/use-form-error/master/src/use-form-error.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-messages.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.10.0/lodash.js"></script>
<div ng-app="ExampleApp">
  <div ng-controller="ExampleController">
    <h3>
      ExampleController
    </h3>
    <form name="ExampleForm" id="ExampleForm">
      <div ng-repeat="(key, data) in groupedByFoodName">
        <p>{{key}} - {{data.length}}</p>
      </div>
    </form>
  </div>
</div>

CSS

.errors {
  color: maroon
}

JavaScript

angular.module('ExampleApp', ['use', 'ngMessages'])
  .controller('ExampleController', function($scope, $parse) {
    $scope.lists = [{
      "_id": "56b0c315e179bb0e00a44dbf",
      "orderfood": [{
        "_id": "569d865bff1fe20e00f8ba97",
        "qty": "1",
        "confirm": true,
        "price": 154,
        "name": "Isnain Meals"
      }, {
        "_id": "569d865bff1fe20e00f8ba98",
        "qty": "1",
        "confirm": true,
        "price": 154,
        "name": "Isnain Meals"
      }],
      "content": "9176649143",
      "created": "2016-02-02T14:54:13.926Z"
    }, {
      "_id": "56b06ed25b53250e00ccbd73",
      "orderfood": [{
        "_id": "569d84f04834c10e003dff36",
        "qty": "1",
        "confirm": true,
        "price": 125,
        "name": "Chicken Burger"
      }],
      "content": "6886058585",
      "created": "2016-02-02T08:54:42.986Z"
    }, {
      "_id": "56b06ed25b53250e00ccbd74",
      "orderfood": [{
        "_id": "569d84f04834c10e003dff37",
        "qty": "1",
        "confirm": true,
        "price": 125,
        "name": "Chicken Burger"
      }],
      "content": "6886058585",
      "created": "2016-02-02T08:54:42.986Z"
    }];

    $scope.groupedByFoodName = _.chain($scope.lists).map(function(each) {
      return each.orderfood
    }).flatten().groupBy(function(each) {
      return each.name
    }).value();

  });