diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index 38f8b5ca00..f52d35837b 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -9,11 +9,21 @@ interface MyAppScope extends ng.IScope { myApp.config(( $stateProvider: ng.ui.IStateProvider, - $urlRouterProvider: ng.ui.IUrlRouterProvider) => { - // - // For any unmatched url, redirect to /state1 - $urlRouterProvider.otherwise("/state1"); - // + $urlRouterProvider: ng.ui.IUrlRouterProvider, + $urlMatcherFactory: ng.ui.IUrlMatcherFactory) => { + + var matcher: ng.ui.IUrlMatcher = $urlMatcherFactory.compile("/foo/:bar?param1"); + + $urlRouterProvider + .when('/test', '/list') + .when(/\/test\d/, ($injector: ng.auto.IInjectorService, $location: ng.ILocationService) => { + return '/list'; + }) + .when(matcher, ['$injector', '$location', ($injector: ng.auto.IInjectorService, $location: ng.ILocationService) => { + return false; + }]) + .otherwise("/state1"); + // Now set up the states $stateProvider .state('state1', { @@ -58,4 +68,4 @@ myApp.config(( "viewB": { template: "route2.viewB" } } }); -}); \ No newline at end of file +});