Include type definition for $uiViewScrollProvider

See http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$uiViewScrollProvider
This commit is contained in:
John Jeffery
2014-05-21 14:29:07 +10:00
parent 03ca52b8f4
commit 00947856ab
2 changed files with 22 additions and 0 deletions

View File

@@ -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();
}]);
}

View File

@@ -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;
}
}