Fixing the animation to work with angularjs