var item = 0 ; var storage = function ( e ) { try { if ( e [ item ] !== undefined ) { console . log ( e [ item ]); } item ++ ; if ( item < e . length ) { setTimeout ( function () { storage ( e ); }, 2000 ); } else { console . log ( "terminado" ); } } catch ( error ) {} } storage ( $scope . arrayFiles );