本文整理匯總了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);
};
}),
示例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;
}
示例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'],
});
});
});
});
示例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'],
});
});
示例5: subscribeOnScope
subscribeOnScope($scope, isPhonePortraitStream(), (isPhonePortrait) => {
$scope.$apply(() => {
console.log('isPhonePortrait', isPhonePortrait);
vm.placeholder = isPhonePortrait
? t('Header.FilterHelpBrief')
: t('Header.FilterHelp', { example: 'is:dupe' });
});
});
示例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);
}));
}
示例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));
}
示例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');
});