angular - ng4-autocomplete 如何在 Angular 4 中使用它给我控制台错误
问题描述
我正在使用 ng4-autocomplete,这给了我错误,这是我的代码。
public list = [
{title: 'Option', id: '1'},
{title: 'Options', id: '2'},
{title: 'Optiond', id: '3'},
{title: 'Optiona', id: '4'},
{title: 'Optione', id: '5'}
];
constructor(public autoCompleteService: AutoCompleteService )
{
this.setList(this.list);
}
setList(list){
this.autoCompleteService.filterName = "title";
this.autoCompleteService.setDynamicList(list);
}
它在控制台中给了我以下错误。请检查我做错了什么。
错误:错误错误:找到对象列表!请提供 filterName 以从对象中提取
这是我的html
<input type="text" [list-length]="10" filterName="title" [word-trigger]="2" no-record-text="No Records Found!" class="form-control" id="list" [ng4-auto-complete]="list">
解决方案
我从ng4-auto-complete
. 它们不再受支持。建议去PrimeNg。
推荐阅读
- android - 将 Gradle 更新到 3.1.1 版后,Android 库无法正常工作
- php - 通过 PHP删除标签并保留标签内容?
- linux - 在循环中使用带有 sql 输出的 for
- arrays - [number, number] 是元组类型吗?
- php - Laravel 全名检查它是否真的完整
- plsql - “ORA-24344:编译成功”错误是什么意思?
- c# - NoesisGUI - 在 Noesis.Image 元素中加载 PNG
- hibernate - 在 HQL 中减去日期
- angular - angular2 从动态子级向父级发出事件
- r - Sum of consecutive same values