Using the $timeout promise as suggested by Alexis Tondelier, see
previous commit for a more detailed step by step process