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


TypeScript angular.IScope類代碼示例

本文整理匯總了TypeScript中angular.IScope的典型用法代碼示例。如果您正苦於以下問題:TypeScript IScope類的具體用法?TypeScript IScope怎麽用?TypeScript IScope使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了IScope類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: FindArtifactFromExecutionCtrl

 mock.inject(($rootScope: IScope) => {
   $scope = $rootScope.$new();
   initializeController = (stage: any) => {
     $scope = $rootScope.$new();
     $scope.stage = stage;
     ctrl = new FindArtifactFromExecutionCtrl($scope);
   };
 }),
開發者ID:spinnaker,項目名稱:deck,代碼行數:8,代碼來源:findArtifactFromExecution.controller.spec.ts

示例2:

export function subscribeOnScope<T>(
  $scope: IScope,
  observable: Observable<T>,
  subscribeFn: (T) => void
): Subscription {
  const subscription = observable.subscribe(subscribeFn);
  $scope.$on('$destroy', () => subscription.unsubscribe());
  return subscription;
}
開發者ID:bhollis,項目名稱:DIM,代碼行數:9,代碼來源:rx-utils.ts

示例3: describe

describe('Controller: ChaosMonkeyExceptions', () => {
  let $componentController: IComponentControllerService,
    $ctrl: ChaosMonkeyExceptionsController,
    $scope: IScope,
    $q: IQService;

  const initializeController = (data: any) => {
    $ctrl = $componentController(
      'chaosMonkeyExceptions',
      { $scope: null, $q },
      data,
    ) as ChaosMonkeyExceptionsController;
  };

  beforeEach(mock.module(CHAOS_MONKEY_EXCEPTIONS_COMPONENT));

  beforeEach(
    mock.inject(
      (_$componentController_: IComponentControllerService, _$q_: IQService, $rootScope: IRootScopeService) => {
        $scope = $rootScope.$new();
        $componentController = _$componentController_;
        $q = _$q_;
      },
    ),
  );

  describe('data initialization', () => {
    it('gets all accounts, then adds wildcard and regions per account to vm', () => {
      const accounts: any = [
        { name: 'prod', regions: [{ name: 'us-east-1' }, { name: 'us-west-1' }] },
        { name: 'test', regions: [{ name: 'us-west-2' }, { name: 'eu-west-1' }] },
      ];

      spyOn(AccountService, 'listAllAccounts').and.returnValue($q.when(accounts));

      initializeController(null);
      $ctrl.application = ApplicationModelBuilder.createApplicationForTests('app', {
        key: 'serverGroups',
        loader: () => $q.resolve([]),
        onLoad: (_app, data) => $q.resolve(data),
      });
      $ctrl.application.serverGroups.refresh();
      $scope.$digest();

      $ctrl.config = new ChaosMonkeyConfig($ctrl.application.attributes.chaosMonkey || {});

      $ctrl.$onInit();
      $scope.$digest();

      expect($ctrl.accounts).toEqual([accounts[0], accounts[1]]);
      expect($ctrl.regionsByAccount).toEqual({
        prod: ['*', 'us-east-1', 'us-west-1'],
        test: ['*', 'us-west-2', 'eu-west-1'],
      });
    });
  });
});
開發者ID:emjburns,項目名稱:deck,代碼行數:57,代碼來源:chaosMonkeyExceptions.component.spec.ts

示例4: it

    it('prunes variables from the config if they no longer exist on the template', () => {
      const spy = spyOn(PipelineTemplateReader, 'getPipelineTemplateFromSourceUrl');
      spy.and.callFake(() => $q.resolve(templateB));

      ctrl.initialize();
      $scope.$digest();

      ctrl.pipelineTemplateConfig = ctrl.buildConfig();

      spy.and.callFake(() => $q.resolve(templateA));
      ctrl.initialize();
      $scope.$digest();

      expect(ctrl.buildConfig().config.pipeline.variables).toEqual({
        letters: ['a', 'b', 'c'],
      });
    });
開發者ID:mizzy,項目名稱:deck,代碼行數:17,代碼來源:configurePipelineTemplateModal.controller.spec.ts

示例5: subscribeOnScope

 subscribeOnScope($scope, isPhonePortraitStream(), (isPhonePortrait) => {
   $scope.$apply(() => {
     console.log('isPhonePortrait', isPhonePortrait);
     vm.placeholder = isPhonePortrait
       ? t('Header.FilterHelpBrief')
       : t('Header.FilterHelp', { example: 'is:dupe' });
   });
 });
開發者ID:bhollis,項目名稱:DIM,代碼行數:8,代碼來源:search-filter.component.ts

示例6:

  public $onInit(): void {
    const { $scope, $rootScope, ClusterFilterModel, clusterFilterService, app } = this;

    this.sortFilter = ClusterFilterModel.sortFilter;
    this.tags = ClusterFilterModel.tags;

    if (app.serverGroups.loaded) {
      this.initialize();
    }

    app.serverGroups.onRefresh($scope, () => this.initialize());

    $scope.$on('$destroy', $rootScope.$on('$locationChangeSuccess', () => {
      ClusterFilterModel.activate();
      clusterFilterService.updateClusterGroups(app);
    }));
  }
開發者ID:brujoand,項目名稱:deck,代碼行數:17,代碼來源:clusterFilter.component.ts

示例7: initDateRange

  private initDateRange(): void {
    this.startDate = moment().startOf('week').toDate();
    this.endDate = moment().endOf('week').toDate();

    this.$scope.$watchGroup([
      () => this.startDate,
      () => this.endDate,
    ], this.onDateRangeChanged.bind(this));
  }
開發者ID:lunches-platform,項目名稱:fe,代碼行數:9,代碼來源:date-range-selector.component.ts

示例8: it

 it('should use "aws" as the default provider if the requested provider cannot be found and there is no default set', () => {
   let provider = '';
   CloudProviderRegistry.registerProvider('fakeProvider', config);
   providerService.selectProvider(application, 'securityGroup').then(_provider => {
     provider = _provider;
   });
   $scope.$digest();
   expect(provider).toBe('aws');
 });
開發者ID:mizzy,項目名稱:deck,代碼行數:9,代碼來源:providerSelection.service.spec.ts


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