[英]Watch for current value of input with update on blur
我有以下输入,它会在模糊事件上更新模型。
<input
es-max-type
class="headline"
ng-change="edit(selectedRow, '{{selectedRow.name}}');"
ng-model="selectedRow.name"
ng-model-options="{ updateOn: 'blur' }"/>
es-max-type指令正在监视字符串长度。
scope.$watch(function() {
return scope.ngModel
}, function(text) {
if(text) {
scope.currentLen = text.length;
}
});
只要关注输入,我就会在角落显示“ 15/100”个字符。 但是由于仅在模糊事件中更新了模型,所以我无法在编辑过程中跟踪更改。 有没有一种方法来获取字符串长度而不删除模糊更新?
尝试监听“输入”事件。 而不是“改变”或“模糊”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.