function handleIfMatch($injector, handler, match) {
    if (!match) return false;
    var result = $injector.invoke(handler, handler, { $match: match });
    return isDefined(result) ? result : true;
  }
@ngdoc object
@name ui.router.router.$urlRouterProvider#otherwise
@methodOf ui.router.router.$urlRouterProvider

@description
Defines a path that is used when an invalid route is requested.

@example
<pre>
var app = angular.module('app', ['ui.router.router']);

app.config(function ($urlRouterProvider) {
  // if the path doesn't match any of the urls you configured
  // otherwise will take care of routing the user to the
  // specified url
  $urlRouterProvider.otherwise('/index');

  // Example of using function rule as param
  $urlRouterProvider.otherwise(function ($injector, $location) {
    return '/a/valid/url';
  });
});
</pre>

@param {string|object} rule The url path you want to redirect to or a function 
rule that returns the url path. The function version is passed two params: 
`$injector` and `$location` services, and must return a url string.

@return {object} `$urlRouterProvider` - `$urlRouterProvider` instance