我们一直在使用ui-select(https://github.com/angular-ui/ui-select)来主题下拉菜单,就像select2一样。除了一个方面,这个功能基本上是有效的:默认占位符。
代码基本上遵循ui-select演示(此页面的第三个示例:http://plnkr.co/edit/a3KlK8dKH3wwiiksDSn2?p=preview)。
据我所知,缺省文本应该是“placeholder”属性的文本。而实际上,在您选择选项之前,它似乎是空白的。为了解决这个问题,我们一直在使用一个hack,即在Angular控制器中将ui-select-match的值设置为相反数,但这远非完美,显然也不是正确的用法。
代码基本上遵循ui-select演示(此页面的第三个示例:http://plnkr.co/edit/a3KlK8dKH3wwiiksDSn2?p=preview)。
据我所知,缺省文本应该是“placeholder”属性的文本。而实际上,在您选择选项之前,它似乎是空白的。为了解决这个问题,我们一直在使用一个hack,即在Angular控制器中将ui-select-match的值设置为相反数,但这远非完美,显然也不是正确的用法。
<ui-select data-ng-model="producttype.selected" theme="select2" name="product-type">
<ui-select-match placeholder="Select a product type">
{{$select.selected.title}}
</ui-select-match>
<ui-select-choices repeat="producttype in productTypeOptions | filter: $select.search">
<span ng-bind-html="producttype.title | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
有人遇到过这个问题吗?或者对我们做错了什么有任何想法吗?
这与IT技术有关。