<h1><code ng:non-bindable="">$routeProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><p>Used for configuring routes. See <a href="api/angular.module.ng.$route"><code>$route</code></a> for an example.</p></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="otherwise">otherwise(params)</h3>
<div class="otherwise"><p>Sets route definition that will be used on route change when no other route definition
is matched.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">params – {Object} – </code>
<p>Mapping information to be assigned to <code>$route.current</code>.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
– <p>self</p></div>
</div>
</li>
<li><h3 id="when">when(path, route)</h3>
<div class="when"><p>Adds a new route definition to the <code>$route</code> service.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">path – {string} – </code>
<p>Route path (matched against <code>$location.path</code>). If <code>$location.path</code>
contains redudant trailing slash or is missing one, the route will still match and the
<code>$location.path</code> will be updated to add or drop the trailing slash to exacly match the
route definition.</p></li>
<li><code ng:non-bindable="">route – {Object} – </code>
<p>Mapping information to be assigned to <code>$route.current</code> on route
match.</p>

<p>Object properties:</p>

<ul>
<li><code>controller</code> – <code>{function()=}</code> – Controller fn that should be associated with newly
created scope.</li>
<li><code>template</code> – <code>{string=}</code> – path to an html template that should be used by
<a href="api/angular.module.ng.$compileProvider.directive.ngView"><code>ngView</code></a> or
<a href="api/angular.module.ng.$compileProvider.directive.ngInclude"><code>ngInclude</code></a> directives.</li>
<li><p><code>redirectTo</code> – {(string|function())=} – value to update
<a href="api/angular.module.ng.$location"><code>$location</code></a> path with and trigger route redirection.</p>

<p>If <code>redirectTo</code> is a function, it will be called with the following parameters:</p>

<ul><li><code>{Object.&lt;string&gt;}</code> - route parameters extracted from the current
<code>$location.path()</code> by applying the current route template.</li>
<li><code>{string}</code> - current <code>$location.path()</code></li>
<li><code>{Object}</code> - current <code>$location.search()</code></li></ul>

<p>The custom <code>redirectTo</code> function is expected to return a string which will be used
to update <code>$location.path()</code> and <code>$location.search()</code>.</p></li>
<li><p><code>[reloadOnSearch=true]</code> - {boolean=} - reload route when only $location.search()
changes.</p>

<p>If the option is set to <code>false</code> and url in the browser changes, then
<code>$routeUpdate</code> event is broadcasted on the root scope.</p></li>
</ul></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
– <p>self</p></div>
</div>
</li>
</ul>
</div>
</div>
