jeudi 8 janvier 2015

Use IF condition in Foreach loop for comparision of data-bind values

I need to compare a value which is returned from the db in a ForEach loop. I am not sure how to pik this value up (ie store it in a variable) and use it for comparison.



<tbody data-bind="foreach: ContractorList">
<tr>
<td>
<a href="#" data-bind="text: Contractor_Name, click: $root.listContractorDetails"></a>
<span data-bind="text:Contractor_Status"></span>
<span data-bind="if: some-syntax?? ">1</span>
<span data-bind="if: same-syntaxt??">2</span>
</td>
</tr>
</tbody>
</table>


The data-bind="text:Contractor_Status" returns "Enrolled" or "Rejected", If Enrolled I want to show span 1 else span 2. Please can you help me with the syntax.


Aucun commentaire:

Enregistrer un commentaire