简体   繁体   English

防止点击加载多动作

[英]Prevent to load multi action with click

I have a large application with Angular include modal form and wizard form and etc . 我在Angular上有一个大型应用程序,包括模式形式和向导形式等。 there is problem that i don't know how to deal with that in best way . 有个问题我不知道如何最好地解决。 the problem is : when user click on modal button there is a delay to open modal meantime if user click on something else all of them run . 问题是:当用户单击模式按钮时,如果用户单击其他所有按钮,则打开模式的时间会有延迟。 i mean modal and other action run together . 我的意思是模态行动和其他行动并存。 what's the best way to handle this ? 处理此问题的最佳方法是什么?

       i konw there is a way to add loading bar and add overlay shadow
 with z-index to prevent another click .  

thx for your suggestion 谢谢你的建议

As you have said, the easiest way is to use a blocking element preventing users from clicking multiple times. 如您所说,最简单的方法是使用阻止元素来防止用户多次单击。 If you don't want to do that, an alternative is use angular events, eg. 如果您不想这样做,则可以使用角度事件,例如。 broadcast/emit/on, each element listens to some events and toggles click enabled status. 广播/发射/开,每个元素都收听一些事件并切换单击启用状态。 Or you can use ng-disabled, and set a rootScope variable eg messageSending, whenever a model dialog is requested, set messageSending = true. 或者,您可以使用ng-disabled并设置rootScope变量(例如messageSending),每当请求模型对话框时,都设置messageSending = true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM