angular-ui/ui-router — pull request #635 by caitp (2013-12-05 03:47:26+00:00)
Title: feat(uiStateActive): directive to add/remove classes for active state

Fixes #19

TODO: Still needs a test suite, I'll try to write some stuff tomorrow. In the
mean time, [here's a prototype](http://plnkr.co/edit/7EBvfxLRsgtjgQfDA5ff?p=preview).

---

Adds a directive to switch a set of classes in a DRY fashion by interacting
with neighboring ui-sref directives.

The class to be used is an interpolated string, which is not $observed. There
is no default, as I do not wish to tie this module to a particular CSS model
or framework. A default may be configured in the future with a provider. As
usual, multiple classes may be used, as Attributes.$addClass/$removeClass will
separate classes on whitespace.

CAVEATS:

This is only capable of working as a parent of a ui-sref directive, or as a
sibling directive on the same element. In the future, there may be a mechanism
around this, but for the time being I can't think of what it would look like.

USAGE:

Sibling directive on same element as ui-sref:
123

--- OR ---

Ancestor directive of ui-sref:

123