Home > DeveloperSection > Forums > create ng Options with Group By
Ankit Singh

Total Post:341

Posted on    February-23-2016 10:09 PM

 Angular JS Angular JS 

 1 Reply(s)
 454  View(s)
Rate this:
We want to create ng options with group by in angular JS .How to do this please help me.

aditya kumar Patel

Total Post:254

Posted on    February-23-2016 10:11 PM


Layout = null;


<!DOCTYPE html>



<meta name="viewport" content="width=device-width" />

<script src="~/Scripts/jquery-1.9.1.js"></script>

<script src="~/Scripts/angular.js"></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"






<body ng-app="myApp" ng-controller="MyCtrl">


Select City :<select ng-model="row"

ng-options="row.modelName as row.displayName group by row.group for row in rows">





Don't want to miss updates? Please click the below button!

Follow MindStick