function update() {
        if ($state.$current.self === state && matchesParams()) {
          $element.addClass(activeClass);
        } else {
          $element.removeClass(activeClass);
        }
      }
@ngdoc directive
@name ui.router.state.directive:ui-sref-active

@requires ui.router.state.$state
@requires ui.router.state.$stateParams
@requires $interpolate

@restrict A

@description
A directive working alongside ui-sref to add classes to an element when the 
related ui-sref directive's state is active, and removing them when it is inactive.
The primary use-case is to simplify the special appearance of navigation menus 
relying on `ui-sref`, by having the "active" state's menu button appear different,
distinguishing it from the inactive menu items.

@example
<pre>
<ul>
  <li ui-sref-active="active" class="item active">
    <a ui-sref="app.user({user: 'bilbobaggins'})" href="/users/bilbobaggins">@bilbobaggins</a>
  </li>
  <!-- ... -->
</ul>
</pre>