I call the modal bootstrap dialog by reference.
I want to start a timer in an angular controller when a dialog box appears. How to detect dialog opening event in angular controller to start timer?
If I start a timer in an area like this,
app.controller('myctrl', ['$scope', '$window', '$timeout', 'svc', function ($scope, $window, $timeout, svc) { $scope.countdown = 10; $scope.runCounter = function () { $scope.countdown -= 1; if ($scope.countdown > 0) $timeout($scope.runCounter, 60000); } $scope.runCounter(); }]);
the timer starts when the application starts. I want the timer to start only when the dialog opens. Thanks.
angularjs twitter-bootstrap
user2793135
source share