Angular ng-change or ng-click for select can't work

doreentseng picture doreentseng · Apr 9, 2015 · Viewed 7.4k times · Source

It's a sample about ng-change with checkbox.

plunker

I'd like to make the checkbox into a selection but failed. Here's the code:

<select>
  <option ng-model="confirmed" ng-change="change()">1</option>
  <option ng-model="confirmed" ng-click="change()">2</option>
</select>

If somebody could help I'll be appreciate.

Answer

Arun P Johny picture Arun P Johny · Apr 9, 2015

You need to bind them to the select element not option

<select ng-model="confirmed" ng-change="change()">
    <option>1</option>
    <option>2</option>
</select>