sacan sacan - 1 year ago 339
AngularJS Question

ng-if with multiple conditions wont work

<tbody ng-repeat= "course in">
<tr ng-repeat="theCourse in" 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>


-condition wont work, I have tried doing like the above, but also tried like this:

<tr ng-if="theCourse._id==course && theCourse.term=='VT2'||theCourse.term=='VT1'">

Somebody know what I'm doing wrong?

Answer Source

It should be:

<tr ng-if="theCourse._id === course && (theCourse.term === 'VT2'|| theCourse.term === 'VT1')">

Note: You should use === to compare values.