You need to smooth the array. Even with group by, it ng-optionsworks on a flat array:
$scope.data2 = [
{primary: "white", sub: "white1"},
{primary: "white", sub: "white2"},
{primary: "white", sub: "white3"},
{primary: "black", sub: "black1"},
{primary: "black", sub: "black2"},
{primary: "black", sub: "black3"},
];
Then you could do:
<select
ng-model="myOption"
ng-options="value as value.sub group by value.primary for value in data2">
</select>
ββ value - , {primary: "white", sub: "white2"}. "white2", "black3" ..... :
ng-options="value.sub as value.sub group by value.primary for value in data2"