complete implementation of ngAnimationDetect directive