用ng-model = "searchKPointObj.namepart",绑定在输入框中,并用ng-change监听,每当输入框发生变化执行下面请求。
但是在我输入一个字时,比如“将”,这里会请求两遍,请求的参数分别是“jiang”和“将”,有什么解决办法么,不想要拼音的。(在chrome上的)
<input type = "text" placeholder = "请输入关键词" ng-model="searchKPointObj.namepart" ng-change="search()">
//监听输入框实时检索知识点
function search(){
sysmanageSer.search(searchKPointObj,function(da){
});
}
世界只因有你2017-05-15 17:07:06
ng-change will be executed every time the data changes. It cannot be executed once for pinyin and once for Chinese characters. Isn’t it a problem with ng-change? I think there should be something wrong with the method you requested later
迷茫2017-05-15 17:07:06
You can try setting an input time interval. ng-model-options={debounce : 1000} How long to delay execution after input stops.
Or filter out Pinyin directly in the search() function