---
title: "create ng Options with Group By"  
description: "create ng Options with Group By"  
author: "Anonymous User"  
published: 2016-02-23  
updated: 2016-02-23  
canonical: https://www.mindstick.com/forum/33995/create-ng-options-with-group-by  
category: "angular js"  
tags: ["angular js"]  
reading_time: 1 minute  

---

# create ng Options with Group By

We want to create ng [options](https://www.mindstick.com/articles/43878/making-the-best-use-of-the-options-trade-ideas) with [group](https://yourviews.mindstick.com/view/81323/adani-green-energy-group-bags-world-s-biggest-solar-bid) by in [angular](https://www.mindstick.com/articles/13081/advantages-disadvantages-of-angularjs-is-that-ideal-for-your-project) JS .How to do this please help me.

## Replies

### Reply by Anonymous User

```
@{    Layout = null;}<!DOCTYPE html><html><head>    <meta name="viewport" content="width=device-width" />    <script src="~/Scripts/jquery-1.9.1.js"></script>    <script src="~/Scripts/angular.js"></script>    <title>Forum</title>    <script>        var app = angular.module('myApp', []);        app.controller('MyCtrl', function ($scope) {            $scope.rows = [            {                "group": "Uttar Pradesh",                "displayName": "Allahabad",                "modelName": "Allahabad"            },            {                "group": "Uttar Pradesh",                "displayName": "Phulpur",                "modelName": "Phulpur"            },
            {
                "group": "Maharashtra",                "displayName": "Thane",                "modelName": "Thane"            },
            {
                "group": "Maharashtra",                "displayName": "Bandra",                "modelName": "Bandra"            }            ,
            {                "group": "Maharashtra",                "displayName": "Kurla",                "modelName": "Kurla"
            }
            ]
        })
    </script>
</head>
<body ng-app="myApp" ng-controller="MyCtrl">
    <div>
    Select City :<select ng-model="row"
                 ng-options="row.modelName as row.displayName group by row.group for row in rows">
                 </select>
    </div>
</body>
</html>
```

```

```


---

Original Source: https://www.mindstick.com/forum/33995/create-ng-options-with-group-by

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
