자식 드롭 다운 전용 부분적으로에 첫 번째 드롭 다운의 문자열이 포함되어있는 경우 계단식 드롭 다운을 사용할 수 있습니까?AngularJS 부분 필터 값이있는 계단식 드롭 다운.
EX: DROPDOWN1: TOOL1 DROPDOWN2: TAGFORTOOL1
TOOL2 TAGFORTOOL2
TOOL3 TAGFORTOOL3
TOOL1을 선택하면 TAGFORTOOL1 만보고 싶습니다. (두 번째 드롭 다운 그냥 필터링하지 않습니다 작동하지 않는)
코드 :
<div ng-controller="ToolListController">
<select ng-model="toolSelectionModel" ng-options="tool.id for tool in tools">
</select>
</div>
<div ng-controller="TagListController">
<select ng-model="tagSelectionModel" ng-options="tag.tagname for tag in tags
| filter:{tagname:toolSelectionModel.tool.id}">
</select>
</div>
컨트롤러 :
reportingControllers.controller('TagListController', ['$scope', 'TagsResource', function($scope, TagsResource) {
$scope.tags = TagsResource.query(); // returns TAGFORTOOL1, TAGFORTOOL2, TAGFORTOOL3
}]);
reportingControllers.controller('ToolListController', function($scope) {
$scope.tools = [
{'id': 'TOOL1'},
{'id': 'TOOL2'},
{'id': 'TOOL3'},
];
});
감사합니다!
감사합니다 스콧, 분명히 나는이 새로운 :). 나는 길을 시도하고이 오류가 발생합니다 : "TypeError : 첫 번째 if 문 줄에"정의되지 않은 ID '속성을 읽을 수 없습니다. 그래서이 시점에서 toolSelectionModel에 대해 알지 못합니까? – dhalia
이렇게하려면 하나의 컨트롤러 만 있으면됩니다. 여기 내가 어떻게 그랬어. – Scott