From 351e8f3ad369a55255c6b7d7cc511b8e5b87e5c1 Mon Sep 17 00:00:00 2001 From: Traxmaxx Date: Fri, 15 Nov 2013 17:08:41 +0100 Subject: [PATCH] Add optional timeout --- angular-flash.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/angular-flash.js b/angular-flash.js index 5d3fa8d..7b98375 100755 --- a/angular-flash.js +++ b/angular-flash.js @@ -29,7 +29,9 @@ angular.module('flash', []) return text ? [{ level: level, text: text }] : [asMessage(level)]; }; - var flash = function(level, text) { + var flash = function(level, text, timeout) { + if (timeout !== undefined) + $timeout(function() { emit(cleanup); }, timeout); emit(messages = asArrayOfMessages(level, text)); }; @@ -55,4 +57,4 @@ angular.module('flash', []) }]; return directive; -}]); \ No newline at end of file +}]);