Route Matching Magic. It matches your routes ... magically!
Clicking "Make Active" will reload the page. Pay attention to the routes.
It would be nice if your app knew what the address path was and acted accordingly, right? Right.
$uiRoute
.
<a ui-route="/page" ng-class="{active: $uiRoute}">link</a>
ui-route
as an attribute with value supports the following:
<a ui-route="/page">
<a ui-route="/page/[0-9]*">
<a ui-route="/page/{{ sample }}">
<a ui-route="/page/{{ sample }}/[0-9]*">
ui-route
with ng-href
attribute:
<a ui-route ng-href="/page">
<a ui-route ng-href="/page/{{ sample }}">
ui-route
with href
attribute:
<a ui-route href="/page">
ui-route
. This model could then be used the same as
$uiRoute
.
<li ui-route="/page/{{ sample }}" ng-model="current">
<ul> <li ui-route="#/route-1">Route 1 <strong ng-show="$uiRoute">IS</strong> <strong ng-show="!$uiRoute">is NOT</strong> active. </li> <li ui-route="#/route-2">Route 2 <strong ng-show="$uiRoute">IS</strong> <strong ng-show="!$uiRoute">is NOT</strong> active. </li> <li ui-route="#/route-3">Route 3 <strong ng-show="$uiRoute">IS</strong> <strong ng-show="!$uiRoute">is NOT</strong> active. </li> </ul>