angularjs if else condition does not work -
i new in angularjs
, working on small module in project. want show 2 div
based on condition. condition if {{ merchandiser.popcode }}
means popcode value exist in database show div1 else show div2. here code snippet
<tr ng-repeat="merchandiser in data.merchandisers | filter: filter()"> <td title = "({{ merchandiser.id }})">{{ $index + 1 }}</td> <td>{{ merchandiser.createdondate }}</td> <!--<td>{{ merchandiser.createdontime }}</td>--> <td>{{ merchandiser.pjpcode }} </td> <td>{{ merchandiser.sectioncode}}</td> <td>{{ merchandiser.popcode }}</td> <td>{{ merchandiser.popname }}</td> <td>{{ merchandiser.popstatus }} </td> <td>{{ merchandiser.channel }} </td> </table> <div class="row"> <div id = "div1" class = "col-sm-4" > <table class = "table"> <tr class="colour"> <th>pop classification</th> <td>{{ popdata.popclassification }}</td> </tr> <tr> <th class="colour">owner's name</th> <td>{{ popdata.ownername }}</td> </tr> </div> <div id = "div2" class = "col-sm-4" > <table class = "table"> <tr>enter code here <th class="colour">owner's name</th> <td>{{ popdata.ownername }}</td> </tr> </div>
try :
<div id="div1" ng-if="merchandiser.popcode"> <!-- condition true show div1 block content --> </div> <div id="div2" ng-if="!merchandiser.popcode"> <!-- condition false show div2 block content --> </div>
Comments
Post a Comment