设置SELECT2输入的宽度(通过角UI指令) [英] set the width of select2 input (through Angular-ui directive)
问题描述
我有问题使这一plunkr(选择2 + angulat-UI)的工作。
I have problem making this plunkr (select2 + angulat-ui) work.
http://plnkr.co/edit/NkdWUO?p=$p$pview
在本地设置,我得到的SELECT2工作,但在文档描述我无法设置宽度。这是太窄,无法使用。
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.
感谢您。
编辑:
别说plnkr,我发现了一个工作在这里捣鼓
http://jsfiddle.net/pEFy6/
它看起来是SELECT2崩溃到第一个元素的宽度的行为。我可以通过引导设置宽度类=输入介质
.Still不知道为什么角UI并不需要的配置参数。
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.
推荐答案
您需要指定属性的宽度,以解决以preserve元素的宽度
You need to specify the attribute width to resolve in order to preserve element width
$(document).ready(function() {
$("#myselect").select2({ width: 'resolve' });
});
这篇关于设置SELECT2输入的宽度(通过角UI指令)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!