0

I am new to AngularJS and have a pretty basic problem I guess.

I have a drop-down list and based on the selection I want a table underneath to update with the belonging information.

<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>

I have a jsfiddle (http://jsfiddle.net/EN3S9/) and appreciate every help. Probably I am not completely understanding the concept yet.

1 Answer 1

1

I think what you are looking for is to filter based on the selected object like:

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

Here is the full demo:

Online Demo

Sign up to request clarification or add additional context in comments.

1 Comment

Great! Thanks! I guess I haven't understood exactly how the filter work. How does the filter know on what parameter to filter on?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.