0

我是 AngularJS 的新手,我猜有一个非常基本的问题。

我有一个下拉列表,根据选择,我希望下面的表格使用所属信息进行更新。

<div ng-controller="RightCtrl as right">
  <select ng-model="right.selectedModule">
    <option ng-repeat="module in right.modules" value="{{module.id}}">{{module.name}}
    </option>
  </select>
  <table>
  <thead>
    <th>Right name</th>
    <th>Description</th>
  </thead>
  <tbody ng-repeat="module in right.modules | filter: right.isCurrent">
  <tr ng-repeat="selRight in module.rights">
    <td right-id="{{selRight.id}}">{{selRight.name}}</td>
    <td>
      {{selRight.description}}
    </td>
  </tr>
  </tbody>
  </table>
</div>

我有一个 jsfiddle ( http://jsfiddle.net/EN3S9/ ) 并感谢每一个帮助。可能我还没有完全理解这个概念。

4

1 回答 1

1

我认为您正在寻找的是根据所选对象进行过滤,例如:

<tbody ng-repeat="module in right.modules | filter:right.selectedModule">

这是完整的演示:

在线演示

于 2014-07-12T18:35:44.060 回答