Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngclick deprecated. Popular alternative or solution?

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.

like image 555
Ahmed-Anas Avatar asked May 11 '16 11:05

Ahmed-Anas


People also ask

How to prevent multiple clicks on submit button in AngularJS?

isDisabled = false; $scope. disableButton = function() { $scope. isDisabled = true; // To disable Button } }); This way you can disable button.

How do I upgrade AngularJS version?

Selecting an update version If there is a big version gap between your application's AngularJS version and the latest, try updating versions incrementally. For example, if your application is running AngularJS 1.2, do not immediately upgrade it to 1.6. 6. Instead choose a version closer to 1.2.

Can I use AngularJS and angular together?

With it you can mix and match AngularJS and Angular components in the same application and have them interoperate seamlessly. That means you don't have to do the upgrade work all at once, since there is a natural coexistence between the two frameworks during the transition period.

Which of the following must be completed to run AngularJS in production Choose all that apply?

By default AngularJS compiles and executes all directives inside comments and element classes. In order to perform this task, the AngularJS compiler must look for directives by: Parse all your application element classes. Parse all your application html comments.


1 Answers

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.

like image 133
Ankh Avatar answered Oct 15 '22 20:10

Ankh