本文整理汇总了TypeScript中angular2/src/facade/async.PromiseWrapper.reject方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PromiseWrapper.reject方法的具体用法?TypeScript PromiseWrapper.reject怎么用?TypeScript PromiseWrapper.reject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/facade/async.PromiseWrapper
的用法示例。
在下文中一共展示了PromiseWrapper.reject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: load
load(template: ViewDefinition) {
if (isPresent(template.template)) {
return PromiseWrapper.resolve(DOM.createTemplate(template.template));
}
if (isPresent(template.absUrl)) {
var content = MapWrapper.get(this._urlData, template.absUrl);
return isPresent(content) ?
PromiseWrapper.resolve(DOM.createTemplate(content)) :
PromiseWrapper.reject(`Failed to fetch url "${template.absUrl}"`, null);
}
return PromiseWrapper.reject('Load failed', null);
}
示例2: get
get(url) {
var response = MapWrapper.get(this._responses, url);
if (isBlank(response)) {
return PromiseWrapper.reject('xhr error');
}
return PromiseWrapper.resolve(response);
}
示例3: get
get(url: string): Promise<string> {
var response = this._responses.get(url);
if (isBlank(response)) {
return PromiseWrapper.reject('xhr error', null);
}
return PromiseWrapper.resolve(response);
}
示例4: load
load(template) {
if (isPresent(template.inline)) {
return PromiseWrapper.resolve(DOM.createTemplate(template.inline));
}
if (isPresent(template.absUrl)) {
var content = this._urlData[template.absUrl];
if (isPresent(content)) {
return PromiseWrapper.resolve(DOM.createTemplate(content));
}
}
return PromiseWrapper.reject('Load failed');
}
示例5: load
load(view: ViewDefinition): Promise<any> {
if (isPresent(view.template)) {
return PromiseWrapper.resolve(DOM.createTemplate(view.template));
}
if (isPresent(view.templateAbsUrl)) {
var content = this._urlData.get(view.templateAbsUrl);
return isPresent(content) ?
PromiseWrapper.resolve(DOM.createTemplate(content)) :
PromiseWrapper.reject(`Failed to fetch url "${view.templateAbsUrl}"`, null);
}
throw new BaseException('View should have either the templateUrl or template property set');
}
示例6: _errorHandler
_errorHandler(key: Key, e): Promise<any> {
if (e instanceof AbstractBindingError) e.addKey(key);
return PromiseWrapper.reject(e);
}
示例7: _errorHandler
_errorHandler(key:Key, e):Promise<any> {
if (e instanceof ProviderError) e.addKey(key);
return PromiseWrapper.reject(e);
}
示例8: BaseException
}, _ => PromiseWrapper.reject(new BaseException(`Failed to fetch url "${url}"`), null));