From 75ae49e85bd24b591424d59f95838b7fa9ece478 Mon Sep 17 00:00:00 2001 From: Bart van den Burg Date: Tue, 22 Dec 2015 15:39:38 +0100 Subject: [PATCH] add some methods defined on the UrlRouter service See https://github.com/angular-ui/ui-router/blob/a7d25c6/src/urlRouter.js#L308 --- angular-ui-router/angular-ui-router-tests.ts | 16 ++++++++++++++-- angular-ui-router/angular-ui-router.d.ts | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/angular-ui-router/angular-ui-router-tests.ts b/angular-ui-router/angular-ui-router-tests.ts index 3211faee5c..41661d60d5 100644 --- a/angular-ui-router/angular-ui-router-tests.ts +++ b/angular-ui-router/angular-ui-router-tests.ts @@ -230,7 +230,7 @@ module UrlRouterProviderTests { // this allows you to configure custom behavior in between // location changes and route synchronization: $urlRouterProvider.deferIntercept(); - }).run(($rootScope: ng.IRootScopeService, $urlRouter: ng.ui.IUrlRouterService, UserService: ITestUserService) => { + }).run(($rootScope: ng.IRootScopeService, $urlRouter: ng.ui.IUrlRouterService, UserService: ITestUserService, $urlMatcher: ng.ui.IUrlMatcher) => { $rootScope.$on('$locationChangeSuccess', e => { // UserService is an example service for managing user state if (UserService.isLoggedIn()) return; @@ -245,6 +245,18 @@ module UrlRouterProviderTests { }); // Configures $urlRouter's listener *after* your custom listener - $urlRouter.listen(); + var listen: Function = $urlRouter.listen(); + + var href: string; + href = $urlRouter.href($urlMatcher); + href = $urlRouter.href($urlMatcher, {}); + href = $urlRouter.href($urlMatcher, {}, {}); + + $urlRouter.update(); + $urlRouter.update(false); + + $urlRouter.push($urlMatcher); + $urlRouter.push($urlMatcher, {}); + $urlRouter.push($urlMatcher, {}, {}); }); } diff --git a/angular-ui-router/angular-ui-router.d.ts b/angular-ui-router/angular-ui-router.d.ts index 014baf5ac4..23d84cbd51 100644 --- a/angular-ui-router/angular-ui-router.d.ts +++ b/angular-ui-router/angular-ui-router.d.ts @@ -283,7 +283,10 @@ declare module angular.ui { * */ sync(): void; - listen(): void; + listen(): Function; + href(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): string; + update(read?: boolean): void; + push(urlMatcher: IUrlMatcher, params?: IStateParamsService, options?: IHrefOptions): void; } interface IUiViewScrollProvider {