Giulio Giulio - 1 year ago 89
Javascript Question

How to setTimeout before the AngularJS ng-click trigger

I need a way to set a timeout before the ng-click is triggered, something like:

window.setTimeout("ng-click='myCtrl.myFunction()', 1000")

I don't think it is possibile but I really need to have this kind of effect.
I have a very particular animated button, when it is clicked it has to call a function in my controller, but that function has to be invoked only when the buttons animation is finished. (I can't use
or something like that inside the function because it keeps the button pressed, and my function has to be executed after the button "get up").

Answer Source


A user solved the problem but he have deleted his answer, anyway, here is the solution:

$scope.clickOnUpload = function () {
  $timeout(function() {
  }, 100);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download