角的UI选择2 - 隐藏组件的初始绘图/渲染 [英] Angular ui-select2 - hide initial drawing/rendering of component
问题描述
我使用的角度与UI的SELECT2评估,并想知道是否有人可以在隐藏的闪烁/转换提供帮助的<选择>
进入SELECT2组件。
I'm evaluating using Angular with ui-select2 and wondered whether someone could provide help on hiding the flicker/conversion of the <select>
into the select2 component.
这只是很简短,但用户可以看到组件的变化样式。
It's only very brief, but users can see the component change styles.
有没有隐藏,直到选择已经被修改SELECT2的一种方式?
Is there a way of hiding it until the select has been modified by select2?
推荐答案
我遇到了同样的问题,我有一个看看源$ C $ C。该指令是故意利用超时后初始化。在code有评论说:初始化插件迟到,使得注入的DOM不破坏模板编译。
I came across the same problem and I had a look at the source code. The directive is deliberately initialised later by using a timeout. In the code there is a comment saying "Initialize the plugin late so that the injected DOM does not disrupt the template compiler".
我的解决方案(你可以看到它在这个jsplunker:的http:// plnkr。 CO /编辑/ fXjDxs?p = preVIEW )是选择标签的可见性设置为隐藏。
My solution (you can see it in this jsplunker: http://plnkr.co/edit/fXjDxs?p=preview ) is to set the visibility of the select tag to "hidden".
<select ui-select2 ng-model="....." style="visibility: hidden; ">......
当组件加载该标签被替换一个div。在UI的select2.js我添加了一个线(208线)将其可见性设置为可见的。
When the component is loaded that tag is replaced with a div. In ui-select2.js I have added a line (line 208) to set its visibility to "visible".
elm.prev().css({"visibility": "visible"});
这篇关于角的UI选择2 - 隐藏组件的初始绘图/渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!