Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a simple table (of uploaded files) where the user makes a choice per row via a dropdown. I now need to collect the rows data, including the selected dropdown value.

I don't know how to get the dropdown value in a button ng-click event. Is there an easy way?

Here is the markup for the table:

HTML
<tbody>
  <tr data-ng-repeat="item in items">
    <td>{{item.FileName}}</td>
    <td>{{item.FileSize}}</td>
    <td>
      <select>
        <option data-ng-repeat="option in item.Options" value="{{option.Value}}">{{option.Text}}</option>
      </select></td>
    <td>
      <div class="btn-group">
        <div class="btn btn-default" data-ng-click="Convert(item.FileName)">Import</div>
        <div class="btn btn-default">Cancel</div>
      </div>
    </td>
  </tr>
</tbody>


Thanks ^_^
Andy
Posted

1 solution

Actually simpler than I thought:


HTML
<tbody>
  <tr data-ng-repeat="item in items">
    <td>{{item.FileName}}</td>
    <td>{{item.FileSize}}</td>
    <td>
      <select data-ng-model="item.Supplier" data-ng-options="option.Text for option in item.Options" /></td>
    <td>
      <div class="btn-group">
        <div class="btn btn-default" data-ng-click="Convert(item.FileName)">Import</div>
        <div class="btn btn-default">Cancel</div>
      </div>
    </td>
  </tr>
</tbody>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900