Updating model after focus is lost on input control

后端 未结 2 832
小鲜肉
小鲜肉 2021-02-09 15:26

In this code:


AngularJS will update the model actionText as the user types stuff

2条回答
  •  一生所求
    2021-02-09 15:32

    I think the easiest way might be just use ng-blur to fire off something you want to do.

    http://plnkr.co/edit/rhcliQRzUOBKQ3xKFrde?p=preview

    app.controller('MainCtrl', function($scope) {
    
      $scope.myDataBlurred = $scope.myData;
    
      $scope.blurred = function() {
         $scope.myDataBlurred = $scope.myData;
      }
    });
    
     
    
        
    This will update as you type: {{myData}}
    This will update after you blur: {{myDataBlurred}}

提交回复
热议问题