jquery - execute SetTimeout or $timeout only on some action -


how can trigger either settimeout or $timeout on button click. right if put inside button click function getting executed on own not waiting click event trigger it.

$scope.btnclick = function () {         settimeout(function () {             $scope.close();         }, 1000)     }  

use $timeout instead of settimeout , use $scope.$apply() in "$scope.close()" function.

note: if want see changes in ui , may use $scope.$apply() in function. using console.log() doesn't prove words ;)


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -