Famous/famous-angular — pull request #113 by stristr (2014-06-28 08:38:36+00:00)
Title: Famo.us/Angular support for $animate events

This PR also adds legacy support for ngAnimate and other systems that involve direct class manipulation.

I cleaned up all of the 'registerChild'/'unregisterChild' boilerplate in the process of getting tests to pass after changing unregistration time from scope.$destroy to element.$destroy. This change of unregistration time was necessary in order to prevent elements from being "unsequenced" before they were done animating, which would cause animations to stop displaying prematurely. Other than that, refactoring is totally confined to the famousAnimate.js file, which uses $delegate to continue the existing fork of the core $animate service, interpreting attributes on arbitrary tags and applying Famo.us animations when animation events occur.

Please note that the fa-surface.js is no longer holding the configuration for forking $animate, because it's now much broader. One existing piece of functionality that has been preserved is the passthrough of addClass, removeClass, and setClass to transcluded content if and when that content represents a "classable" entity like a Surface, ImageSurface, etc. The mechanism, however, is also broader than before: in addition to hooking into $animate.addClass and $animate.removeClass, we are also forking the underlying implementations (angular.element.prototype.addClass and angular.element.prototype.removeClass) and applying class manipulation to underlying Surfaces whenever we can. This is the mechanism through which ngAnimate (the module) is supported broadly when animation events occur on Surfaces.

It should also mean, for example, that "element.addClass" or "element.removeClass" in a directive or controller applied to an faSurface will pass the class manipulation down to the surface. My feeling is this is not really something we should recommend people doing (direct class manipulation of the Surface will always be more efficient and cleaner), but adding this is a good bit of legacy support for people who are upgrading legacy apps.