0

I have a table displaying my Users. A user can be assigned to muptiple companies. I need to display that in the table. I have seen some similar posts that reference some tree directives. They appear to be more complex than what I need. I created a plunker. Plunker

 <table class="table table-bordered">
  <thead>
    <tr>
      <th>Company(s) Name</th>
      <th>Name</th>
      <th>UserName</th>
      <th>Email</th>
    </tr>
  </thead>
  <tbody>
    <tr ng-repeat="user in users | filter:search">
      <td>{{user.Companies.CompanyName}}</td>
      <td>{{user.Name}}</td>
      <td>{{user.UserName}}</td>
      <td>{{user.Email}}</td>
    </tr>
  </tbody>
</table>

1 Answer 1

1

Try that

<tr ng-repeat="user in users | filter:search">
  <td>
    <font ng-repeat="company in user.Companies">{{company.CompanyName}}{{$last?'': ','}} </font>
    </td>
  <td>{{user.Name}}</td>
  <td>{{user.UserName}}</td>
  <td>{{user.Email}}</td>
</tr>

See in plunker

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.