Replaced setTimeout with $timeout service