3

This seems to be a really straight forward code, but I cannot figure out why it is not working.

I want to filter the 'model' dropdown by selected 'make',

    Make:
    <select ng-model="makeng" ng-options="option.display for option in makes">
      <option ng-disabled="true"  ng-selected="true" value="">Select a make</option>
    </select>  
    Model:
    <select ng-model="modelng" ng-options="option.display for option in models | filter:{make:makeng}">
      <option ng-disabled="true"  ng-selected="true" value="">Select a model</option>
    </select>

here is the plunker

http://plnkr.co/edit/bHb9AScd2m58acUUyI0t?p=preview

Annie C
  • 764
  • 2
  • 12
  • 31

1 Answers1

4

Problem is with your first ngoption, you need to set the model as the value of value property using select as syntax option.value as option..

<select ng-model="makeng" 
       ng-options="option.value as option.display for option in makes">

Plnkr

PSL
  • 123,204
  • 21
  • 253
  • 243