Presuming your json looks something like this
$scope.dropdown = [
{
name:'Malaysia',
items: [
{name: 'sunway', value: 1},
{name: 'subang', value: 2},
{name: 'petaling jaya', value: 3}
]
},
{
name:'Japan',
items: [
{name: 'tokyo', value: 4},
{name: 'osaka', value: 5},
{name: 'kyoto', value: 6}
]
}
]
this should work:
<select>
<optgroup ng-repeat="header in dropdown" label="{{ header.name }}">
<option ng-repeat="item in header.items" value="{{ item.value }}">{{ item.name }}</option>
</optgroup>
</select>
EDIT
demo: http://jsfiddle.net/jkrielaars/5wg9ejzg/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…