From 00947856ab3da5c8d57c2474edc4c6c819fc3799 Mon Sep 17 00:00:00 2001 From: John Jeffery Date: Wed, 21 May 2014 14:29:07 +1000 Subject: [PATCH] Include type definition for $uiViewScrollProvider See http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$uiViewScrollProvider --- angular-ui/angular-ui-router-tests.ts | 14 ++++++++++++++ angular-ui/angular-ui-router.d.ts | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index d7dbe7183..60f4a28fc 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -110,3 +110,17 @@ class UrlLocatorTestService implements IUrlLocatorTestService { } myApp.service("urlLocatorTest", UrlLocatorTestService); + +module UiViewScrollProviderTests { + var app = angular.module("uiViewScrollProviderTests", ["ui.router"]); + + app.config(['$uiViewScrollProvider', function($uiViewScrollProvider: ng.ui.IUiViewScrollProvider) { + // This prevents unwanted scrolling to the active nested state view. + // Use this when you have nested states, but you don't want the browser to scroll down the page + // to the nested state view. + // + // See https://github.com/angular-ui/ui-router/issues/848 + // And https://github.com/angular-ui/ui-router/releases/tag/0.2.8 + $uiViewScrollProvider.useAnchorScroll(); + }]); +} \ No newline at end of file diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 7db3f399c..499f1c474 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -105,4 +105,12 @@ declare module ng.ui { */ sync(): void; } + + interface IUiViewScrollProvider { + /* + * Reverts back to using the core $anchorScroll service for scrolling + * based on the url anchor. + */ + useAnchorScroll(): void; + } }