angularjs ng选项,条件基于另一个ng模型

时间:2016-10-17 05:26:40

标签: angularjs

我必须使用对象的嵌套属性过滤ng选项。这是我的代码

<select ng-model="clas.department" ng-options="department as department.name for department in departments  | filter:{department.course.id : clas.course.id}: true">
  <option value="">Select Department</option>
</select>
其中clas.course.id是另一个模型。

我收到此错误:

angular.js:12477 Error: [$parse:syntax] http://errors.angularjs.org/1.4.7/$parse/syntax?p0=.&p1=is%20unexpected%2C%20expecting%20%5B%3A%5D&p2=34&p3=departments%20%20%7CNaNilter%3A%7Bdepartment.course.id%20%3A%clas.course.id%7D%3A%20true&p4=.course.id%20%3A%clas.course.id%7D%3A%20true at Error (native) at http://localhost:8000/js/angular.min.js:6:416 at Object.throwError (http://localhost:8000/js/angular.min.js:209:339) at Object.consume (http://localhost:8000/js/angular.min.js:210:9) at Object.object (http://localhost:8000/js/angular.min.js:209:171) at Object.primary (http://localhost:8000/js/angular.min.js:206:151) at Object.unary (http://localhost:8000/js/angular.min.js:205:503) at Object.multiplicative (http://localhost:8000/js/angular.min.js:205:249) at Object.additive (http://localhost:8000/js/angular.min.js:205:76) at Object.relational (http://localhost:8000/js/angular.min.js:204:416)

0 个答案:

没有答案