user7367398
user7367398

Reputation:

html input datalist get selected value and pass into method

i have an html input data list where i need to pass the selected value into javascript / angular. It needs to be passed as the datalist is going into a html table so there will be many of them. All the examples i have seen grab it in the javascript instead of passing it into a method.

I tried on-select but it did nothing. I am also using angular 1

<datalist id="dataList">
 <option ng-repeat="note in linknotes" value="{{note}}">{{note}}</option>
 </datalist>
<input maxlength="50" type="text" list="dataList">


 $scope.linknotes = [
    'Note 1',
    'Note 2',
    'Note 3',
    'Note 4',
    'Note 5',
    'Note 6'
].sort();

Upvotes: 0

Views: 373

Answers (1)

Ash_s94
Ash_s94

Reputation: 817

Not sure exactly what you're asking here but I'm assuming you're referring to using ($index). You can pass the selected object from ng-repeat into a function using this. Here's a link with an example.

Upvotes: 1

Related Questions