Fix exception caused by scope.$on('destroy') by using setTimeout