当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript IRootScopeService.%24on方法代码示例

本文整理汇总了TypeScript中angular.IRootScopeService.%24on方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IRootScopeService.%24on方法的具体用法?TypeScript IRootScopeService.%24on怎么用?TypeScript IRootScopeService.%24on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular.IRootScopeService的用法示例。


在下文中一共展示了IRootScopeService.%24on方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3:

    $setupHelpExtensionAutoClear: ($rootScope: IRootScopeService, $injector: any) => {
      const $route = $injector.has('$route') ? $injector.get('$route') : {};

      $rootScope.$on('$routeChangeStart', () => {
        helpExtensionSetSinceRouteChange = false;
      });

      $rootScope.$on('$routeChangeSuccess', () => {
        const current = $route.current || {};

        if (helpExtensionSetSinceRouteChange || (current.$$route && current.$$route.redirectTo)) {
          return;
        }

        newPlatformChrome.setHelpExtension(current.helpExtension);
      });
    },
开发者ID:lucabelluccini,项目名称:kibana,代码行数:17,代码来源:help_extension.ts

示例4: run

export function run(
    $log: ILogService,
    $rootScope: IRootScopeService,
    $timeout: ITimeoutService
) {
    $log.debug('app module - run');

    $rootScope.$on('$stateChangeStart',
        function (event: ng.IAngularEvent, toState) {
            $log.debug('$stateChangeStart - name:', toState.name);
        });

    $rootScope.$on('$stateChangeSuccess',
        function (event, toState) {
            $log.debug('$stateChangeSuccess - name:', toState.name);
        });

    $rootScope.$on('$stateNotFound',
        function (event, unfoundState, fromState, fromParams) {
            $log.warn('$stateNotFound', {
                event: event,
                unfoundState: unfoundState,
                fromState: fromState,
                fromParams: fromParams
            });
        });

    $rootScope.$on('$stateChangeError',
        function (event, toState, toParams, fromState, fromParams, error) {
            $log.error('$stateChangeError', {
                event: event,
                toState: toState,
                toParams: toParams,
                fromState: fromState,
                fromParams: fromParams,
                error: error
            });
            if (error) {
                throw error;
            }
        });
};
开发者ID:egilsster,项目名称:ionic-webpack-typescript,代码行数:42,代码来源:index.run.ts

示例5: bindEvents

  private bindEvents(): void {
    // WHY??? Because, when the stateChangeStart event fires, the $location.search() will return whatever the query
    // params are on the route we are going to, so if the user is using the back button, for example, to go to the
    // Infrastructure page with a search already entered, we'll pick up whatever search was entered there, and if we
    // come back to this application, we'll get whatever that search was.
    this.$rootScope.$on('$locationChangeStart', (_event: IAngularEvent, toUrl: string, fromUrl: string) => {
      const [oldBase, oldQuery] = fromUrl.split('?'),
        [newBase, newQuery] = toUrl.split('?');

      if (oldBase === newBase) {
        this.mostRecentParams = newQuery ? UrlParser.parseQueryString(newQuery) : {};
      } else {
        this.mostRecentParams = oldQuery ? UrlParser.parseQueryString(oldQuery) : {};
      }
    });

    this.$rootScope.$on('$stateChangeStart', (_event: IAngularEvent, toState: Ng1StateDeclaration, _toParams: StateParams, fromState: Ng1StateDeclaration, fromParams: StateParams) => {
      if (this.movingFromSecurityGroupState(toState, fromState)) {
        this.asFilterModel.saveState(fromState, fromParams, this.mostRecentParams);
      }
    });

    this.$rootScope.$on('$stateChangeSuccess', (_event: IAngularEvent, toState: Ng1StateDeclaration, toParams: StateParams, fromState: Ng1StateDeclaration) => {
      if (this.isSecurityGroupStateOrChild(toState.name) && this.isSecurityGroupStateOrChild(fromState.name)) {
        this.asFilterModel.applyParamsToUrl();
        return;
      }
      if (this.movingToSecurityGroupState(toState)) {
        if (this.shouldRouteToSavedState(toParams, fromState)) {
          this.asFilterModel.restoreState(toParams);
        }

        if (this.fromSecurityGroupsState(fromState) && !this.asFilterModel.hasSavedState(toParams)) {
          this.asFilterModel.clearFilters();
        }
      }
    });
  }
开发者ID:robfletcher,项目名称:deck,代码行数:38,代码来源:securityGroupFilter.model.ts

示例6: watchFn

 scope.$on( '$destroy', () => {
     $rootScope.$on( '$ionicView.beforeLeave', () => modal.hide() );
     modal.remove();
     watchFn();
 });
开发者ID:prodest,项目名称:es-na-palma-da-mao-mobile,代码行数:5,代码来源:modal.component.ts

示例7: ItemReviewController

function ItemReviewController(
  this: IController & {
    item: DimItem;
    toUserReview(item: DimItem): WorkingD1Rating | WorkingD2Rating;
    findReview(reviewId: string): D1ItemUserReview | D2ItemUserReview | null;
    getReviewData(): number[];
  },
  $rootScope: IRootScopeService
) {
  'ngInject';

  const vm = this;
  vm.canReview = settings.allowIdPostToDtr;
  vm.allowIdPostToDtr = settings.allowIdPostToDtr;
  vm.showReviews = settings.showReviews;
  vm.toggledFlags = [];
  vm.submitted = false;
  vm.isCollapsed = false;
  vm.expandReview = false;

  vm.$onInit = () => {
    vm.canCreateReview = vm.canReview && vm.item.owner;

    if (vm.item.isDestiny1()) {
      if (vm.item.dtrRating && vm.item.dtrRating.userReview) {
        vm.expandReview =
          vm.item.dtrRating.userReview.rating !== 0 &&
          !vm.item.dtrRating.userReview.treatAsSubmitted;
      }
    } else if (vm.item.isDestiny2()) {
      if (vm.item.dtrRating && vm.item.dtrRating.userReview) {
        vm.expandReview =
          vm.item.dtrRating.userReview.voted !== 0 &&
          !vm.item.dtrRating.userReview.treatAsSubmitted;

        if (!vm.item.dtrRating.userReview.mode) {
          vm.item.dtrRating.userReview.mode = settings.reviewsModeSelection;
        }
      }
    }

    vm.reviewData = vm.getReviewData();

    if (vm.item.isDestiny2()) {
      getDefinitions().then((defs) => {
        vm.reviewModeOptions = getReviewModes(defs);
      });
    }
  };

  vm.toggleChart = () => {
    vm.isCollapsed = !vm.isCollapsed;
  };

  vm.procon = false; // TODO: turn this back on..
  vm.aggregate = {
    pros: ['fast', 'lol'],
    cons: ['ok']
  };

  vm.toggleEdit = () => {
    vm.expandReview = !vm.expandReview;

    if (vm.item.isDestiny2() && vm.item.dtrRating && vm.item.dtrRating.userReview.voted !== 0) {
      vm.item.dtrRating.userReview.voted = 0;
      vm.reviewBlur();
    }
  };

  vm.clickReview = (reviewId: string) => {
    const review = this.findReview(reviewId);

    if (review && review.isReviewer) {
      vm.editReview();
    } else if (review && !review.isHighlighted) {
      vm.openFlagContext(reviewId);
    }
  };

  vm.openFlagContext = (reviewId: string) => {
    const review = this.findReview(reviewId);

    if (review && (review.isReviewer || review.isHighlighted)) {
      return;
    }

    const toggledReviewIndex = vm.toggledFlags.indexOf(reviewId);

    if (toggledReviewIndex === -1) {
      vm.toggledFlags.push(reviewId);
    }
  };

  vm.closeFlagContext = (reviewId: string) => {
    const toggledReviewIndex = vm.toggledFlags.indexOf(reviewId);

    vm.toggledFlags.splice(toggledReviewIndex);
  };

  vm.findReview = (reviewId: string): D1ItemUserReview | D2ItemUserReview | null => {
//.........这里部分代码省略.........
开发者ID:bhollis,项目名称:DIM,代码行数:101,代码来源:item-review.component.ts


注:本文中的angular.IRootScopeService.%24on方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。