MaterializeCSS选择不适用于ng-repeat [英] MaterializeCSS select not working with ng-repeat
问题描述
使用重复选项(使用ng-repeat
)对CSS进行材料选择不起作用.请协助!
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>
推荐答案
我遇到了类似的问题.
根据MaterializeCSS文档,您需要使用以下内容初始化您的选择:
According to the MaterializeCSS documentation, you need to initialize your select with this:
$(document).ready(function() {
$('select').material_select();
});
$(document).ready(function() {
$('select').material_select();
});
您还需要在编译ng-repeat之后再次调用$('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.
来源: http://materializecss.com/forms.html#select-initialization
这篇关于MaterializeCSS选择不适用于ng-repeat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!