mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 04:49:15 +08:00
Add .reload() definition. Add test for it and other tests for the ng.ui.IStateService
This commit is contained in:
@@ -78,12 +78,13 @@ interface IUrlLocatorTestService {
|
||||
|
||||
// Service for determining who the currently logged on user is.
|
||||
class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
static $inject = ["$http", "$rootScope", "$urlRouter"];
|
||||
static $inject = ["$http", "$rootScope", "$urlRouter", "$state"];
|
||||
|
||||
constructor(
|
||||
private $http: ng.IHttpService,
|
||||
private $rootScope: ng.IRootScopeService,
|
||||
private $urlRouter: ng.ui.IUrlRouterService
|
||||
private $urlRouter: ng.ui.IUrlRouterService,
|
||||
private $state: ng.ui.IStateService
|
||||
) {
|
||||
$rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event));
|
||||
}
|
||||
@@ -107,6 +108,23 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private stateServiceTest() {
|
||||
this.$state.go("myState");
|
||||
this.$state.transitionTo("myState");
|
||||
if (this.$state.includes("myState") === true) {
|
||||
//
|
||||
}
|
||||
if (this.$state.is("myState") === true) {
|
||||
//
|
||||
}
|
||||
if (this.$state.href("myState") === "/myState") {
|
||||
//
|
||||
}
|
||||
this.$state.get("myState");
|
||||
this.$state.get();
|
||||
this.$state.reload();
|
||||
}
|
||||
}
|
||||
|
||||
myApp.service("urlLocatorTest", UrlLocatorTestService);
|
||||
@@ -124,4 +142,3 @@ module UiViewScrollProviderTests {
|
||||
$uiViewScrollProvider.useAnchorScroll();
|
||||
}]);
|
||||
}
|
||||
|
||||
|
||||
1
angular-ui/angular-ui-router.d.ts
vendored
1
angular-ui/angular-ui-router.d.ts
vendored
@@ -86,6 +86,7 @@ declare module ng.ui {
|
||||
get(): IState[];
|
||||
current: IState;
|
||||
params: IStateParamsService;
|
||||
reload(): void;
|
||||
}
|
||||
|
||||
interface IStateParamsService {
|
||||
|
||||
Reference in New Issue
Block a user