MaterializeCSS选择不适用于ng-repeat [英] MaterializeCSS select not working with ng-repeat

查看:70
本文介绍了MaterializeCSS选择不适用于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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆