當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angular.IRootScopeService類代碼示例

本文整理匯總了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);
      }
    });
  };
開發者ID:gingerwizard,項目名稱:kibana,代碼行數:28,代碼來源:breadcrumbs.ts

示例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");
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:8,代碼來源:nav-bar.controller.spec.ts

示例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
        });
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:9,代碼來源:year.controller.spec.ts

示例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");
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:12,代碼來源:ca-meeting-panel.controller.spec.ts

示例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
        });
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:13,代碼來源:sign-up.controller.spec.ts

示例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);
      });
    });
  }
開發者ID:grafana,項目名稱:grafana,代碼行數:55,代碼來源:bridge_srv.ts

示例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);
    });
開發者ID:brujoand,項目名稱:deck,代碼行數:12,代碼來源:authentication.interceptor.spec.ts

示例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: () => {}
        };
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:29,代碼來源:ca-password-confirmation.controller.spec.ts

示例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;
        });
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:30,代碼來源:meeting-form.controller.spec.ts

示例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
        });
    }));
開發者ID:disco-funk,項目名稱:ca-london-angular,代碼行數:25,代碼來源:downloads.controller.spec.ts


注:本文中的angular.IRootScopeService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。