Search code examples
angularjsangularjs-materialmd-select

AngularJS Material dropdown options not working


I'm trying to build a form using AngularJS Material and am having problems getting my dropdown options to show up. My HTML is below and my options are stored in an object array on my server script. What am I doing wrong below?

<md-input-container class="md-block" flex-gt-sm ng-switch-when="choice">
    <label for="{{element.section_element_name}}">{{element.section_element_label}}</label>
    <md-select id={ {element.section_element_name}} type="selectbasic" value={{element.q_value}}>
        <md-option ng-repeat="option in element.section_element_choices" value="{{option.element_choice_value}}">
            {{option.element_choice_label}}
        </md-option>
    </md-select>
</md-input-container>

Solution

  • <md-input-container class="md-block" flex-gt-sm ng-switch-when="choice">
      <label for="{{element.section_element_name}}">{{element.section_element_label}}</label>
      <md-select id={ {element.section_element_name}} type="selectbasic" ng-model="selectedItem">
        <md-option ng-repeat="option in element.section_element_choices" value="{{option.element_choice_value}}">
            {{option.element_choice_label}}
        </md-option>
    </md-select>