ngclick 已弃用.流行的替代方案或解决方案? [英] ngclick deprecated. Popular alternative or solution?

查看:37
本文介绍了ngclick 已弃用.流行的替代方案或解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 angular 的新手.ng-click 似乎是一个非常核心的指令,我不明白如何在没有 ng-click 的情况下制作应用程序.我错过了什么吗?显然它已被弃用.并且文档指向我 fastclick 但这不是一个角度实现.

I'm new to angular. ng-click seems like a pretty core directive, I don't understand how you can make an app without ng-click. Am I missing something? Apparently it's deprecated. And the docs point me to fastclick but that's not an angular implementation.

是否有一种流行的非弃用方式来做 ng-click 所做的事情?我在 bower 上找不到任何流行的软件包.谢谢.

Is there a popular non-deprecated way of doing what ng-click did? I couldn't find any popular packages on bower for this. Thanks.

推荐答案

ng-click 仅在 ngTouch 模块由于在移动浏览器中使用时出现延迟.

ng-click is only being deprecated within the ngTouch module due to delays when used in mobile browsers.

从 Angular 1.5 开始,此指令已弃用,默认情况下禁用.该指令将不会得到进一步的支持,并且可能会从未来的版本中删除.如果您需要该指令,您可以使用 $ 启用它touchProvider#ngClickOverrideEnabled 函数.我们还建议您迁移到 FastClick.要了解有关 300 毫秒延迟的更多信息,请参阅这篇 Telerik 文章 提供了很好的概述.

Beginning with Angular 1.5, this directive is deprecated and by default disabled. The directive will receive no further support and might be removed from future releases. If you need the directive, you can enable it with the $touchProvider#ngClickOverrideEnabled function. We also recommend that you migrate to FastClick. To learn more about the 300ms delay, this Telerik article gives a good overview.

常规 ngClick 核心ng 模块将不受影响.

Regular ngClick in the core ng module will remain unaffected.

如果您确实需要使用 fastclick 作为替代方案,则有几个角度包装版本可用.一个两个.

If you do infact need to use fastclick as an alternative there are a couple of angular wrapped versions available. One, Two.

这篇关于ngclick 已弃用.流行的替代方案或解决方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆