【发布时间】:2017-03-24 19:37:35
【问题描述】:
在这个answer 中,向我解释了使用selectItem 来获取选择事件。
但是此时,我绑定到文本框的模型仍然是用户输入的原始文本,而不是选择项。
我用
(selectItem)="search(model)"
获取事件,并在 TS 中
search(model) {
this._service.search(model).subscribe(
results => this.results = results,
error => this.errorMessage = <any>error);
}
但如上所述,使用用户输入的文本调用我的后端,而不是预先输入的所选项目的全文。
我的后台日志
2017/03/24 20:44:14 /api/typeahead/ok
2017/03/24 20:44:14 /api/search/ok
第二个应该是 /api/search/$actualSelectedItem。
【问题讨论】:
标签: angular bootstrap-typeahead ng-bootstrap