问题
MaterializeCSS select with repeated options (using ng-repeat
) is not working. Kindly assist!
<div class="col s12 input-field">
<select ng-model="selected-category" id="category" name="category" class="">
<option value="" selected>Choose Category</option>
<option ng-repeat="c in categories" value="c.catCode">{{c.catDescription}}</option>
</select>
</div>
回答1:
I'm having a similar problem.
According to the MaterializeCSS documentation, you need to initialize your select with this:
$(document).ready(function() {
$('select').material_select();
});
You also need to call $('select').material_select();
again after your ng-repeat is compiled in order for your select to have the correct options populated.
Source: http://materializecss.com/forms.html#select-initialization
来源:https://stackoverflow.com/questions/37997013/materializecss-select-not-working-with-ng-repeat