gpt4 book ai didi

angular - ng-paste 在 angular2 中不起作用

转载 作者:太空狗 更新时间:2023-10-29 18:05:54 26 4
gpt4 key购买 nike

我试图通过取消粘贴事件来防止在 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com