[英]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.