【发布时间】:2015-03-30 23:02:54
【问题描述】:
这是我在 angular ui-select 中得到的完整错误
Error: [$interpolate:interr] Can't interpolate: {{$select.getPlaceholder()}} TypeError: Cannot read property 'length' of undefined
我的标记是:
<ui-select multiple ng-model="case.keywords" theme="bootstrap">
<ui-select-match placeholder="Select keywords...">{{$item.name}}</ui-select-match>
<ui-select-choices repeat="keywords in keywords | filter: $select.search">
<div ng-bind-html="keyword.name | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
<p>Selected: {{case.keywords}}</p>
除了getting 来自 db 的关键字数组之外,控制器中没有什么特别之处。显然ngSanitize和ui.select都包含在模块依赖中。
我遇到的另一个问题是选择不可见。我可以显示选定的选项,但选项列表不可见。我正在使用引导主题,select.css 被引用。这是它的样子
感谢您的帮助。
【问题讨论】:
-
github.com/angular-ui/ui-select/wiki/ui-select 这是 ui-select 的 wiki。它显示了如何使用
$select。我只是从那里拿走了它 -
您使用的是哪个版本的 angular 和 ui-select?
-
您能说出“关键字”的设置方式和时间吗?还有 case.keywords ? .我试图理解这个序列。另外,关键字列表是否大于 Case.Keywords?如果是,您应该在单击 UISelect 时看到选项(但这些选项不会显示所选项目)
-
最有可能的问题是,uiselect 将列表设为未定义,并且它正在其上运行转发器,因此未定义长度。您可以尝试在加载时设置关键字 =[],我想这应该可以解决您看到的错误
-
@Sincere 还有角度版本?我问的原因是我推迟了从 ui-select2 迁移,即使它在 ui-select 中的某些错误已被弃用 b/c。我相信在 1.2.18 版本之前,一些带有引导主题的多项选择无法正常工作。