亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

javascript - angularjs ngblur does not take effect but onblur takes effect, why?
淡淡煙草味
淡淡煙草味 2017-06-30 09:57:53
0
2
875
<input class="detail-reply"
        id="replyInput"
        type="text"
        ng-model="$ctrl.replyString">

This input will not be triggered using ng-blur, but the direct DOM binding onblur event will be triggered. Why?

淡淡煙草味
淡淡煙草味

reply all(2)
世界只因有你

Are you using 1 or 2? If it is 2, you can
<input type="text" [(ngModel)]="myModel" (blur)="onBlurMethod()">

export class AppComponent { 
  myModel: any;
  constructor(){
    this.myModel = '123';
  }
  onBlurMethod(){
   alert(this.myModel) 
  }
}
淡淡煙草味

angular1’s ng-blur can only be used through instructions. The function of the instructions is actually to apply the event bound by ng-blur to the onblur event

app.directive('ngBlur', ['$parse', function($parse) {
  return function(scope, element, attr) {
    var fn = $parse(attr['ngBlur']);
    element.bind('blur', function(event) {
      scope.$apply(function() {
        fn(scope, {$event:event});
      });
    });
  }
}]);
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template