我有以下输入,它会更新模糊事件模型。
<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”字符数中显示。但由于模型仅在模糊事件上更新,因此我无法在编辑过程中跟踪更改。有没有办法获得字符串长度而不删除模糊更新?
答案 0 :(得分:0)
尝试倾听&#34;输入&#34;事件。而不是&#34;改变&#34;或&#34;模糊&#34;