MaterializeCSS select not working with ng-repeat

我的未来我决定 提交于 2020-01-04 07:53:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!