我试图通过取消粘贴事件来防止在 angular2 中使用 ng-paste 粘贴到文本框中。我让它在 angularJS 中工作,但在 angular2 中不行。我是在做错什么还是在 angular2 中不起作用?
<input type="text" #username class="form-control" id="username" required
placeholder="Username" value="{{userName}}" ng-paste="$event.preventDefault()">
最佳答案
使用 (paste)="$event.preventDefault()"
或 (paste)="false"
。
关于angular - ng-paste 在 angular2 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43809465/