设置select2输入的宽度(通过Angular-ui指令) [英] set the width of select2 input (through Angular-ui directive)
问题描述
我有问题使这个plunkr(select2 + angulat-ui)工作。
看起来像是select2的行为折叠到第一个元素的宽度。我可以通过引导 class =input-medium
设置宽度.Stam不确定为什么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屋!