【发布时间】:2013-12-09 11:42:19
【问题描述】:
<select multiple ng-model="comp" ng-options="c.name for c in companies | unique: 'company'" style="width: 100%; height: 200px; float: left; margin-bottom: 20px"></select>
<table>
<tr ng-repeat="c in comp">
<td>{{ c.id }}</td>
</tr>
</table>
<select multiple ng-model="dep" ng-options="c.name for c in departments | filter: {company_id: comp.id}" style="width: 100%; height: 200px; float: left; margin-bottom: 20px"></select>
<select multiple ng-model="pos" ng-options="c.name for c in positions | unique: 'position' | filter: {department_id: dep.id}" style="width: 100%; height: 200px; float: left"></select>
是我的代码的样子,但它只能部分工作。如果我通过ng-repeat 循环它,当我单击选择框中的公司时,c.id 会打印得很好。麻烦的是 - 它不会在我想要过滤结果的其他选择框中打印出来。这可能是什么原因?
JSFiddle: http://jsfiddle.net/9Ymvt/853/
【问题讨论】:
-
你能在 Fiddle 中演示一下吗?在此处获取模板:jsfiddle.net/9Ymvt/852
-
@MaximShoustin 好的,这里是jsfiddle.net/9Ymvt/853
标签: javascript angularjs loops model linked-list