[英]change in input with angular 2 dynamic detection
I have a textbox which act as a search text box. 我有一个文本框,它充当搜索文本框。 I would like to update the search on text change.
我想更新有关文本更改的搜索。 This is what I tried with:
这是我尝试过的:
<input id="searchTextField" [(ngModel)]="searchText" (change)="SearchTextChange()" />
and the typescript backend code 和打字稿后端代码
private SearchTextChange(): void
{
//dostuff
}
problem is this only gets triggered off when I click somewhere outside of textbox. 问题是,只有在单击文本框之外的某个地方时,才会触发此问题。 It doesn't gets triggered off when on the change of text.
更改文本时不会触发它。 Why is this so?
为什么会这样呢?
我怀疑这应该对你有用
[(ngModel)]="searchText" (ngModelChange)="SearchTextChange()"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.