Merge pull request #7300 from Burgov/urlroutermethods

add some methods defined on the UrlRouter service
This commit is contained in:
Masahiro Wakame
2015-12-23 18:12:32 +09:00
2 changed files with 18 additions and 3 deletions

View File

@@ -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, {}, {});
});
}

View File

@@ -300,7 +300,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 {