<tbody ng-repeat= "course in year.courses">
<tr ng-repeat="theCourse in vm.courses" ng-if="theCourse._id==course && theCourse.term==('VT2'||'VT1')">
<td >{{theCourse.courseName}}</td>
<td >{{theCourse.courseCode}}</td>
<td >{{theCourse.term}}</td>
<td >{{theCourse.block}}</td>
<td >{{theCourse.credits}}</td>
</tr>
</tbody>OR-condition不起作用,我试过像上面这样做,但也尝试过这样做:
<tr ng-if="theCourse._id==course && theCourse.term=='VT2'||theCourse.term=='VT1'">有人知道我做错了什么吗?
发布于 2016-05-31 08:18:36
它应该是:
<tr ng-if="theCourse._id === course && (theCourse.term === 'VT2'|| theCourse.term === 'VT1')">注意:您应该使用===来比较值。
发布于 2016-05-31 08:24:55
可使用括号
<tr ng-if="(theCourse._id==course && theCourse.term=='VT2')||theCourse.term=='VT1'">我抄袭了我的评论,只是作为回答
https://stackoverflow.com/questions/37540236
复制相似问题