mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #1637 from santialbo/patch-2
(angular-ui-router) Set `toPath` argument to any
This commit is contained in:
@@ -9,11 +9,23 @@ 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', '/list')
|
||||
.when('/test', '/list')
|
||||
.when(/\/test\d/, '/list')
|
||||
.when(/\/test\d/, ($injector: ng.auto.IInjectorService, $location: ng.ILocationService) => '/list')
|
||||
.when(/\/test\d/,['$injector', '$location', ($injector: ng.auto.IInjectorService, $location: ng.ILocationService) => '/list'])
|
||||
.when(matcher, '/list')
|
||||
.when(matcher, ($injector: ng.auto.IInjectorService, $location: ng.ILocationService) => '/list')
|
||||
.when(matcher, ['$injector', '$location', ($injector: ng.auto.IInjectorService, $location: ng.ILocationService) => '/list'])
|
||||
.otherwise("/state1");
|
||||
|
||||
// Now set up the states
|
||||
$stateProvider
|
||||
.state('state1', {
|
||||
@@ -58,4 +70,4 @@ myApp.config((
|
||||
"viewB": { template: "route2.viewB" }
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+10
-2
@@ -42,12 +42,20 @@ declare module ng.ui {
|
||||
}
|
||||
|
||||
interface IUrlRouterProvider extends IServiceProvider {
|
||||
when(whenPath: string, toPath: string): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
|
||||
when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;
|
||||
when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;
|
||||
when(whenPath: string, handler: Function): IUrlRouterProvider;
|
||||
when(whenPath: string, handler: any[]): IUrlRouterProvider;
|
||||
when(whenPath: string, toPath: string): IUrlRouterProvider;
|
||||
otherwise(handler: Function): IUrlRouterProvider;
|
||||
otherwise(handler: any[]): IUrlRouterProvider;
|
||||
otherwise(path: string): IUrlRouterProvider;
|
||||
otherwise(path: Function): IUrlRouterProvider;
|
||||
rule(handler: Function): IUrlRouterProvider;
|
||||
rule(handler: any[]): IUrlRouterProvider;
|
||||
}
|
||||
|
||||
interface IStateOptions {
|
||||
|
||||
Reference in New Issue
Block a user