84669 Lernen von Personen
152542 Lernen von Personen
20005 Lernen von Personen
5487 Lernen von Personen
7821 Lernen von Personen
359900 Lernen von Personen
3350 Lernen von Personen
180660 Lernen von Personen
48569 Lernen von Personen
18603 Lernen von Personen
40936 Lernen von Personen
1549 Lernen von Personen
1183 Lernen von Personen
32909 Lernen von Personen
<input class="detail-reply" id="replyInput" type="text" ng-model="$ctrl.replyString">
Diese Eingabe nutzt das auszulösende ng-blur是不会触发的,但是直接DOM绑定onblur-Ereignis. Warum?
ng-blur
onblur
你用的是1还是2如果是2的话,可以<input type="text" [(ngModel)]="myModel" (blur)="onBlurMethod()">
<input type="text" [(ngModel)]="myModel" (blur)="onBlurMethod()">
export class AppComponent { myModel: any; constructor(){ this.myModel = '123'; } onBlurMethod(){ alert(this.myModel) } }
angular1的ng-blur要通过指令才能使用,指令的作用其实就是将ng-blur绑定的事件应用到onblur事件
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}); }); }); } }]);
你用的是1还是2如果是2的话,可以
<input type="text" [(ngModel)]="myModel" (blur)="onBlurMethod()">
angular1的ng-blur要通过指令才能使用,指令的作用其实就是将ng-blur绑定的事件应用到onblur事件