本文整理汇总了TypeScript中angular.IRootScopeService类的典型用法代码示例。如果您正苦于以下问题:TypeScript IRootScopeService类的具体用法?TypeScript IRootScopeService怎么用?TypeScript IRootScopeService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRootScopeService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: catch
internals.$setupBreadcrumbsAutoClear = ($rootScope: IRootScopeService, $injector: any) => {
const uiSettings = chrome.getUiSettingsClient();
const $route = $injector.has('$route') ? $injector.get('$route') : {};
$rootScope.$on('$routeChangeStart', () => {
breadcrumbSetSinceRouteChange = false;
});
$rootScope.$on('$routeChangeSuccess', () => {
const current = $route.current || {};
if (breadcrumbSetSinceRouteChange || (current.$$route && current.$$route.redirectTo)) {
return;
}
const k7BreadcrumbsProvider = current.k7Breadcrumbs;
if (!k7BreadcrumbsProvider || !uiSettings.get('k7design')) {
newPlatformChrome.setBreadcrumbs([]);
return;
}
try {
chrome.breadcrumbs.set($injector.invoke(k7BreadcrumbsProvider));
} catch (error) {
fatalError(error);
}
});
};
示例2: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
const $rootScope: IRootScopeService = $injector.get("$rootScope");
$scope = $rootScope.$new(true);
$location = $injector.get("$location");
sharedRouteParamsService = $injector.get("SharedRouteParamsService");
}));
示例3: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
const $rootScope: IRootScopeService = $injector.get("$rootScope");
$scope = $rootScope.$new(true);
ctrl = $controller("YearCtrl", {
$scope: $scope
});
}));
示例4: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
const $rootScope: IRootScopeService = $injector.get("$rootScope");
$scope = $rootScope.$new(true);
$location = $injector.get("$location");
meetingService = $injector.get("MeetingService");
sharedRouteParamsService = $injector.get("SharedRouteParamsService");
sharedRouteParamsService.resetRouteProperties();
spyOn(meetingService, "getWeekday");
}));
示例5: beforeEach
beforeEach(angular.mock.inject($injector => {
$q = $injector.get("$q");
$location = $injector.get("$location");
$controller = $injector.get("$controller");
loginService = $injector.get("LoginService");
alertModalService = $injector.get("AlertModalService");
const $rootScope: IRootScopeService = $injector.get("$rootScope");
$scope = $rootScope.$new(true);
ctrl = $controller("SignUpCtrl", {
$scope: $scope
});
}));
示例6: init
init() {
this.$rootScope.$on('$routeUpdate', (evt, data) => {
const angularUrl = this.$location.url();
const state = store.getState();
if (state.location.url !== angularUrl) {
store.dispatch(
updateLocation({
path: this.$location.path(),
query: this.$location.search(),
routeParams: this.$route.current.params,
})
);
}
});
this.$rootScope.$on('$routeChangeSuccess', (evt, data) => {
store.dispatch(
updateLocation({
path: this.$location.path(),
query: this.$location.search(),
routeParams: this.$route.current.params,
})
);
});
// Listen for changes in redux location -> update angular location
store.subscribe(() => {
const state = store.getState();
const angularUrl = this.$location.url();
const url = locationUtil.stripBaseFromUrl(state.location.url);
if (angularUrl !== url) {
this.$timeout(() => {
this.$location.url(url);
// some state changes should not trigger new browser history
if (state.location.replace) {
this.$location.replace();
}
});
console.log('store updating angular $location.url', url);
}
});
appEvents.on('location-change', (payload: any) => {
const urlWithoutBase = locationUtil.stripBaseFromUrl(payload.href);
if (this.fullPageReloadRoutes.indexOf(urlWithoutBase) > -1) {
this.$window.location.href = payload.href;
return;
}
this.$timeout(() => {
// A hack to use timeout when we're changing things (in this case the url) from outside of Angular.
this.$location.url(urlWithoutBase);
});
});
}
示例7: it
it('resolves immediately for relative and non-http requests', function() {
let resolved: IRequestConfig = null;
const request: IRequestConfig = { url: '/something/relative', method: 'GET' };
interceptor.request(request).then(function(result) { resolved = result; });
$rootScope.$digest();
expect(resolved.url).toBe(request.url);
request.url = 'tcp://what.are.you.doing.here';
interceptor.request(request).then(function(result) { resolved = result; });
$rootScope.$digest();
expect(resolved.url).toBe(request.url);
});
示例8: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
$rootScope = $injector.get("$rootScope");
$scope = $rootScope.$new(true);
ctrl = $controller("CaPasswordConfirmationCtrl", {
$scope: $scope
});
ctrl.passwordConfirmationForm = {
$setPristine: () => {},
$pristine: true,
$dirty: false,
$valid: true,
$invalid: false,
$submitted: false,
$error: undefined,
$name: "fakeform",
$pending: undefined,
$addControl: () => {},
$removeControl: () => {},
$setValidity: () => {},
$setDirty: () => {},
$commitViewValue: () => {},
$rollbackViewValue: () => {},
$setSubmitted: () => {},
$setUntouched: () => {}
};
}));
示例9: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
$rootScope = $injector.get("$rootScope");
$q = $injector.get("$q");
$location = $injector.get("$location");
$scope = $rootScope.$new(true);
meetingService = $injector.get("MeetingService");
sharedRouteParamsService = $injector.get("SharedRouteParamsService");
session = $injector.get("SessionService");
meetingPreviewModalService = $injector.get("MeetingPreviewModalService");
alertModalService = $injector.get("AlertModalService");
session.userName = "testusernamecom";
session.groups = ["LitOrder"];
districts = [
{Area: "AREA1", AreaDescription: "Area 1 Desc", District: "DISTRICT1", DistrictDescription: "District 1 Desc"},
{Area: "AREA2", AreaDescription: "Area 2 Desc", District: "DISTRICT2", DistrictDescription: "District 2 Desc"},
{Area: "AREA3", AreaDescription: "Area 3 Desc", District: "DISTRICT3", DistrictDescription: "District 3 Desc"}
];
spyOn(alertModalService, "show");
spyOn($location, "path");
spyOn(meetingService, "getDistricts").and.callFake(() => {
const deferred: IDeferred<any> = $q.defer();
deferred.resolve(districts);
return deferred.promise;
});
}));
示例10: beforeEach
beforeEach(angular.mock.inject($injector => {
$controller = $injector.get("$controller");
$rootScope = $injector.get("$rootScope");
$q = $injector.get("$q");
downloadsService = $injector.get("DownloadsService");
$scope = $rootScope.$new(true);
spyOn(downloadsService, "getDownloads").and.callFake(() => {
const deferred: IDeferred<Array<IDownload>> = $q.defer();
deferred.resolve(TestDownloads);
return deferred.promise;
});
spyOn(downloadsService, "getCategories").and.callFake(() => {
const deferred: IDeferred<Array<string>> = $q.defer();
deferred.resolve(["Assembly Minutes", "ASC Minutes", "SR14"]);
return deferred.promise;
});
ctrl = $controller("DownloadsCtrl", {
$scope: $scope
});
}));