Using $timeout instead of $rootScope.$apply