本文整理汇总了TypeScript中angular.IQService.reject方法的典型用法代码示例。如果您正苦于以下问题:TypeScript IQService.reject方法的具体用法?TypeScript IQService.reject怎么用?TypeScript IQService.reject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular.IQService
的用法示例。
在下文中一共展示了IQService.reject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('sets appropriate flags when task load fails', function() {
spyOn(TaskReader, 'getTasks').and.returnValue($q.reject(null));
configureApplication();
expect(application.getDataSource('tasks').loaded).toBe(false);
expect(application.getDataSource('tasks').loading).toBe(false);
expect(application.getDataSource('tasks').loadFailure).toBe(true);
});
示例2: fetchBasket
fetchBasket(): IPromise<IBasket> {
const basket = this.localStorageService.get('basket');
if (basket) {
return this.$q.resolve(basket);
} else {
return this.$q.reject({msg: 'No basket found in local storage'});
}
}
示例3:
(response: IHttpPromiseCallbackArg<any>) => {
const error: any = {
status: response.status,
message: response.statusText
};
if (response.data && response.data.message) {
error.log = response.data.message;
} else {
error.log = 'Sorry, no more information.';
}
return this.$q.reject(error);
}
示例4: listMasters
public listMasters(type: BuildServiceType = null): IPromise<string[]> {
const allMasters: IPromise<string[]> = this.API.one('v2').one('builds').get();
if (!allMasters) {
return this.$q.reject('An error occurred when retrieving build masters');
}
switch (type) {
case BuildServiceType.Jenkins:
return allMasters.then(masters => masters.filter(master => !(/^travis-/.test(master))));
case BuildServiceType.Travis:
return allMasters.then(masters => masters.filter(master => /^travis-/.test(master)));
default:
return allMasters;
}
}
示例5: it
it('sets advanced mode when metrics fail to load', () => {
alarm = makeAlarm('AWS/EC2', 'CPUUtilization', 'GreaterThanThreshold', [
{
name: 'AutoScalingGroupName',
value: 'asg-v000',
},
]);
serverGroup = makeServerGroup('asg-v000');
initialize();
spyOn(CloudMetricsReader, 'listMetrics').and.returnValue($q.reject(null));
$ctrl.$onInit();
$scope.$digest();
expect($ctrl.state.metricsLoaded).toBe(true);
expect($ctrl.state.advancedMode).toBe(true);
});
示例6: transRejected
transRejected(error): (StateDeclaration|IPromise<any>) {
let {transition, $state, $stateParams, $q} = this;
// Handle redirect and abort
if (error instanceof TransitionRejection) {
if (error.type === RejectType.IGNORED) {
// Update $stateParmas/$state.params/$location.url if transition ignored, but dynamic params have changed.
let dynamic = $state.$current.parameters().filter(prop('dynamic'));
if (!Param.equals(dynamic, $stateParams, transition.params())) {
this.updateStateParams();
}
return $state.current;
}
if (error.type === RejectType.SUPERSEDED && error.redirected && error.detail instanceof TargetState) {
return this._redirectMgr(transition.redirect(error.detail)).runTransition();
}
}
this.$transitions.defaultErrorHandler()(error);
return $q.reject(error);
}
示例7: Error
promise = promise.then(() => {
const error: Error & { level?: string } = new Error($i18next.t('Loadouts.TooManyRequested', { total: totalAmount, itemname: item.name, requested: pseudoItem.amount }));
error.level = 'warn';
return $q.reject(error);
});
示例8:
.catch(err => {
this.$log.error(err);
this.$q.reject("Unable to save data");
});
示例9: function
getData: function (): IPromise<any> | IPerson[] {
if ((tp.settings().getData as jasmine.Spy).calls.count() > 1) {
return $q.reject('BANG!');
}
return [{ age: 1 }]
}