2

我有以下内容:

<select
    data-ng-model="option.selectedValue"
    data-ng-options="item.id as item.name for item in option.selects">
</select>

<table>
    <thead>
        <tr>
            <th>Id</th>
            <th>City</th>
            <th>Street</th>
        </tr>
    </thead>
    <tbody class="grid">
        <tr data-ng-repeat="row in grid.data">
            <td>{{ row.iD }}</td>
            <td>{{ row.city }}</td>
            <td>{{ row.street }}</td>
        </tr>
    </tbody>
</table>

有没有办法让我改变它,所以只有当option.selectedValue等于 0时街道列才可见

4

2 回答 2

3

{{row.street}}在你的和street线上试试这个

<th ng-show='option.selectedValue == 0'>Street</th>
...
<td ng-show='option.selectedValue == 0'>{{row.street}}</td>

或者

<th ng-hide="option.selectedValue != 0">Street</th>
...
<td ng-hide='option.selectedValue != 0'>{{row.street}}</td>

一样的 ;)

于 2013-08-04T17:39:15.343 回答
1

使用 ng-show。您需要同时隐藏header columncontent column

<th ng-show="option.selectedValue == 0">Street</th>
<td ng-show="option.selectedValue == 0">{{ row.street }}</td>

Demo

于 2013-08-04T17:44:17.360 回答