Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度:每次TextArea模型更新时,TextArea都会失去焦点_Javascript_Jquery_Angularjs_Socket.io - Fatal编程技术网

Javascript 角度:每次TextArea模型更新时,TextArea都会失去焦点

Javascript 角度:每次TextArea模型更新时,TextArea都会失去焦点,javascript,jquery,angularjs,socket.io,Javascript,Jquery,Angularjs,Socket.io,我正在使用Socket.io在textarea上的数据更新时向所有it订户广播更改,但我遇到的问题是,当数据更新且textarea处于focus状态时,它会丢失所有focus。我只想更新文本区域仅当它处于模糊状态且从不处于焦点状态时 我试着写这篇文章,但没用 <textarea ng-model-options="{ updateOn: 'blur'}" ng-model="value.note"></textarea> 找到了替代解决方案 <textarea

我正在使用
Socket.io
在textarea上的数据更新时向所有it订户广播更改,但我遇到的问题是,当数据更新且
textarea
处于
focus状态时,它会丢失所有
focus
。我只想更新
文本区域
仅当它处于
模糊状态
且从不处于
焦点状态

我试着写这篇文章,但没用

<textarea ng-model-options="{ updateOn: 'blur'}"  ng-model="value.note"></textarea>

找到了替代解决方案

<textarea ng-blur="saveNote(value)" ng-model="value.note" ></textarea>
app.controller('testController', function($scope){ 
    $scope.persistedValue = '';
    $scope.saveNote = function(value){
       var note = value.note;
       if(note !== $scope.persistedValue){
         //Only save if persistentValue is different from note value  


       }
    }
});