I should have something visible for 3-4 seconds. I am trying to use $ timeout to achieve this. Here is what I got so far:
$timeout(function() {
debugger;
$scope.$on(broadcastService.topErrorBar.show,
function(event, message) {
$scope.rootElement.addClass('is-visible');
$scope.isVisible = true;
$scope.message = message;
});
}, 3000);
$timeout.cancel(function() {
$scope.close();
});
$scope.close = function() {
$scope.rootElement.removeClass('is-visible');
$scope.isVisible = false;
};
This does not work, and I cannot solve the problem. What am I doing wrong? Should I use a timeout in this case.
source
share