Firefox中的Promise调用Angular 2

时间:2016-11-02 20:03:05

标签: angular adblock

JB Nizet,谢谢!问题不是Adblock,而是Firefox浏览器。 我更改了标题和问题描述。 在Firefox中简单的Angular 2调用出错的原因是什么?         返回this.http.get(this.APIGetPrice + zipcode)             。承诺()             。然后(this.extractData)             .catch(this.handleError);

我的问题页面: http://www.asbuiltsolutions.com/AsbuiltQuotes.html?p=1 输入415并单击Next Step。

IE和Chrome没有问题。 Chrome调试屏幕:

enter image description here

调试点位于app.services.js中, 函数是APIRequestService.prototype.getPrice 下一步是:APIRequestService.prototype.extractData,我有我需要的所有数据。enter image description here

但Firefox返回一个复杂的堆栈跟踪,我无法调试: enter image description here

有人可以帮我用Firefox调试来发现问题吗? 谢谢。

1 个答案:

答案 0 :(得分:0)

来自github的家伙给了我一个提示,我应该在哪里寻找问题: https://github.com/angular/angular/issues/12695

"所以我看到的是FFox发送了不同的Accept标头(text / html,application / xhtml + xml,application / xml; q = 0.9, / ; q = 0.8)与Chrome中的 / 相比。"

我接受了我的打字稿文件中的所有标题 私有标头=新标头({'内容类型':' / '}); 我的WebApiConfig文件中的受限制的xml类型为: var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType ==" application / xml"); config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);

How do I get ASP.NET Web API to return JSON instead of XML using Chrome?