angularjs ngblur不生效 onblur生效,为什么?

<input class="detail-reply"

        id="replyInput"

        type="text"

        ng-model="$ctrl.replyString">

这个input使用ng-blur是不会触发的,但是直接DOM绑定onblur事件是会触发,为什么?

缥缈止盈
浏览 669回答 1
1回答

慕姐4208626

你用的是1还是2如果是2的话,可以<input type="text" [(ngModel)]="myModel" (blur)="onBlurMethod()">export class AppComponent {&nbsp;&nbsp; myModel: any;&nbsp; constructor(){&nbsp; &nbsp; this.myModel = '123';&nbsp; }&nbsp; onBlurMethod(){&nbsp; &nbsp;alert(this.myModel)&nbsp;&nbsp; }}
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript