jeudi 8 décembre 2016

how to show column only when prior column has a specific value

I am pulling data from database into a table.

A fraction of the table code is as below

<tr>
    <th>Approved</th>
    <th>Edit</th>
</tr>
<tr ng-repeat="x in list">
    <td>
        <span data-ng-show="!editable"></span>
        <span data-ng-show="editable">
             <select style="" class="form-control" ng-model="x.approved">
                  <option value="Y">Y</option>
                  <option value="N">N</option>
             </select>
        </span>
    </td>
    <td>
        <span type="submit" data-ng-hide="editable" data-ng-click="editable = true" class="glyphicon glyphicon-edit"></span>
        <span type="submit" data-ng-show="editable" data-ng-click="editable = false; change($index)" class="glyphicon glyphicon-ok-circle"></span>
        <span type="submit" data-ng-show="editable" data-ng-click="editable = false; cancel()" class="glyphicon glyphicon-remove-circle"></span> 
    </td>
</tr>

Approved column gives either a 'Y' or a 'N'. I have written the javascript code(change($index) functionality) at the backend to exchange values of Y and N on my necessity.

the second column shows an editable icon at all times for me to change values. I want it to show the editable icon only when == N so that i can change the approved status to Y.

I am not sure how or where to use the ng-show option.

Tried but not able to understand if ng-show='=="N"' works or not in the "td" element.

Help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire