私が達成しようとしているのは、「親」コンボボックスに依存するアイテムを子コンボボックスに取り込むことです。
問題を明確にするために、このリンクの下にフィドルを作成しました。
コンボボックスの「アイテム」は、コンボボックスの「グループ」が変更されるたびに入力する必要があります。
コントローラ:
function Controller( $scope ) {
var groups = [ ]; // ommitted for the sake of clarity
$scope.groups = groups; // <- linked to cboGroup
$scope.currentGroup = groups[0]; // <- should be updated from combobox
$scope.currentItems = $scope.currentGroup.Items; // <- linked to cboItems
$scope.currentItem = $scope.currentItems[0]; // <- should be updated from cboItems
}
意見
<select data-ng-model="currentGroup" data-ng-options="group.Name for group in groups"></select>
<select data-ng-model="currentItem" data-ng-options="item.Name for item in currentItems"></select>
これを宣言的に実現することはできません。これは魔法の JavaScript がなくても動作するはずです。
ご支援いただきありがとうございます