设置 select2 输入的宽度(通过 Angular-ui 指令) [英] set the width of select2 input (through Angular-ui directive)
问题描述
我在使这个 plunkr (select2 + angulat-ui) 工作时遇到问题.
看起来折叠到第一个元素的宽度是select2的行为.我可以通过 bootstrap class="input-medium"
设置宽度.仍然不知道为什么 angular-ui 不接受配置参数.
需要指定属性宽度来解析以保留元素宽度
$(document).ready(function() {$("#myselect").select2({ width: 'resolve' });});
I have problem making this plunkr (select2 + angulat-ui) work.
http://plnkr.co/edit/NkdWUO?p=preview
In local setup, I get the select2 work, but I cannot set the width as described in the docs. It is too narrow to be used.
Thank you.
EDIT: Never mind that plnkr, I found a working fiddle here http://jsfiddle.net/pEFy6/
It looks like it is the behavior of select2 to collapse to the width of first element. I could set the width through bootstrap class="input-medium"
.Still not sure why angular-ui doesn't take config parameters.
You need to specify the attribute width to resolve in order to preserve element width
$(document).ready(function() {
$("#myselect").select2({ width: 'resolve' });
});
这篇关于设置 select2 输入的宽度(通过 Angular-ui 指令)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!