ui-router fix

move parameters() and format() from IUrlMatcherFactory to IUrlMatcher.

Also adds tests for IUrlMatcher
This commit is contained in:
Matt York
2014-06-20 18:27:04 -07:00
parent d5b8b95a2d
commit edb66b0c70
2 changed files with 6 additions and 2 deletions

View File

@@ -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')

View File

@@ -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 {