mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-03-29 17:08:21 +08:00
ui-router fix
move parameters() and format() from IUrlMatcherFactory to IUrlMatcher. Also adds tests for IUrlMatcher
This commit is contained in:
@@ -13,6 +13,10 @@ myApp.config((
|
||||
$urlMatcherFactory: ng.ui.IUrlMatcherFactory) => {
|
||||
|
||||
var matcher: ng.ui.IUrlMatcher = $urlMatcherFactory.compile("/foo/:bar?param1");
|
||||
var obj: Object = matcher.exec('/user/bob', { x:'1', q:'hello' });
|
||||
var concat: ng.ui.IUrlMatcher = matcher.concat('/test');
|
||||
var str: string = matcher.format({ id:'bob', q:'yes' });
|
||||
var arr: string[] = matcher.parameters();
|
||||
|
||||
$urlRouterProvider
|
||||
.when('/test', '/list')
|
||||
|
||||
4
angular-ui/angular-ui-router.d.ts
vendored
4
angular-ui/angular-ui-router.d.ts
vendored
@@ -33,13 +33,13 @@ declare module ng.ui {
|
||||
interface IUrlMatcher {
|
||||
concat(pattern: string): IUrlMatcher;
|
||||
exec(path: string, searchParams: {}): {};
|
||||
parameters(): string[];
|
||||
format(values: {}): string;
|
||||
}
|
||||
|
||||
interface IUrlMatcherFactory {
|
||||
compile(pattern: string): IUrlMatcher;
|
||||
isMatcher(o: any): boolean;
|
||||
parameters(): string[];
|
||||
format(values: {}): string;
|
||||
}
|
||||
|
||||
interface IUrlRouterProvider extends IServiceProvider {
|
||||
|
||||
Reference in New Issue
Block a user