【发布时间】:2016-04-07 23:39:47
【问题描述】:
我正在尝试在标题过滤器模板中使用 ui-select,但无法使其工作;
谢谢!
[1]: http://plnkr.co/edit/vOdh7PSL4rIESQKJu4rn?p=preview
【问题讨论】:
标签: angularjs angular-ui-grid ui-select
我正在尝试在标题过滤器模板中使用 ui-select,但无法使其工作;
谢谢!
[1]: http://plnkr.co/edit/vOdh7PSL4rIESQKJu4rn?p=preview
【问题讨论】:
标签: angularjs angular-ui-grid ui-select
你的 plunker 看起来不错。无法告诉你哪里出错了,但如果我使用模板而不是你的指令,它就会起作用。
<script type="myTemplate" id="uiSelectTemplate">
<ui-select ng-model = "colFilter.term" append-to-body = "true" class="g-select">
<ui-select match-placeholder="colFilter.placeholder">< /ui-select-match> < ui - select - choices repeat = "option.id as option.value for option in colFilter.options" >
<div ng - bind = "option.value" > < /div></ui - select - choices > < /ui-select>
</script>
然后使用:
$templateCache.put('#cohortVersionToolBar')
将模板插入到网格中。
您必须将 $templateCache 注入您的控制器。 我已经分叉了你的 plunkr。 Here it is
【讨论】:
您使用 ui-select 是否有任何特定原因?这可以通过创建指令来完成。检查我的 plunkr...
[http://plnkr.co/edit/tXZYrfQFzLhred5i0UeG?p=preview][1]
【讨论】: