Add the type function to angular ui-router url matcher factory

This commit is contained in:
Panu Horsmalahti
2014-12-29 11:23:25 +02:00
parent a12472597c
commit 9a4a67a24c
2 changed files with 8 additions and 0 deletions

View File

@@ -13,6 +13,13 @@ myApp.config((
$urlMatcherFactory: ng.ui.IUrlMatcherFactory) => {
var matcher: ng.ui.IUrlMatcher = $urlMatcherFactory.compile("/foo/:bar?param1");
$urlMatcherFactory.type("myType2", {
encode: function (item: any) { return item; },
decode: function (item: any) { return item; },
is: function (item: any) { return true; }
});
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' });

View File

@@ -42,6 +42,7 @@ declare module ng.ui {
interface IUrlMatcherFactory {
compile(pattern: string): IUrlMatcher;
isMatcher(o: any): boolean;
type(name: string, definition: any, definitionFn?: any): any;
}
interface IUrlRouterProvider extends IServiceProvider {