I am displaying some data in a smart-table component(using angular
). The last column is a select element. What i want to do is plug-in to the "on-select
" change event and do something with the data displayed in the row.
Here is my plunker :
What i want to achieve is displayed in the comment
If you want to create a Dropdown list its better to use ng-options then ng-repeat.
<select ng-options="x.data for x in myItems">
</select>
Because the ngRepeat directive repeats a block of HTML code for each item in an array, it can be used to create options in a dropdown list, but the ngOptions directive was made especially for filling a dropdown list with options, and has at least one important advantage:
Dropdowns made with ng-options allows the selected value to be an object, while dropdowns made from ng-repeat has to be a string.
Add ng-change:
<select ng-change="SelectedRow()" ng-options="x.data for x in myItems">
</select>
Then in our controller:
$scope.SelectedRow = function(){
//here take action or do whatever you want to.
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With