ngclick deprecated. Popular alternative or solution?

亡梦爱人 提交于 2019-12-10 13:23:43

问题


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.

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.


回答1:


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

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.

Regular ngClick in the core ng module will remain unaffected.

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



来源:https://stackoverflow.com/questions/37161489/ngclick-deprecated-popular-alternative-or-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!