質問

I have a plunker set up http://plnkr.co/edit/fZ6akOYipzZ7ym8dliCV?p=preview

I want the first list to filter the group in the next list. It seems like it should be simple but i cannot seem to get it to function as desired. Any help will be appreciated.

役に立ちましたか?

解決

http://plnkr.co/edit/l63zgdyDeZnvNGVAar6P?p=preview

You need to use just filter the first array with .filter method on the array, and check to see if the type is equal to the other type in a function (like get(option2))

<select id="unitTypes_speciality" name="speciality" data-role="none" data-ng-model="speciality" 
ng-options="p as p.label group by p.type for p in get(options2, type)"><option>None</option></select>

$scope.get = function(myarray, type) {
  return myarray.filter(function(value) { return value.type == $scope.type.label })
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top