本文介绍了Angular2应用程序在Chrome和IE中可用,但不能用于Firefox或Safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Chrome和IE(11)中,应用程序运行良好,但在Firefox(42.0)或Safari(5.1.7)中不能运行。

strong>:

改变对象的[[Prototype]]会导致代码运行速度非常慢;而是使用Object.create es6-shim.js:1338:11创建具有正确的初始[[Prototype]]值的对象。

Angular 2正在开发模式下运行。调用enableProdMode()来启用生产模式。 angular2.dev.js:351:5
$ b

EXCEPTION:Error:Expected int32 as second argument angular2.dev.js:23524

    call()angular2.dev.js:1145PlatformRef_< /PlatformRef_.prototype._initApp/< /<()angular2.dev.js:14801NgZone< /NgZone.prototype._notifyOnError()angular2.dev.js:5796NgZone< NgZone.prototype._createInnerZone / errorHandling< .onError()angular2.dev.js:5700run()angular2-polyfills.js:141map @ http:// localhost:53861 / lib / es6-shim / es6-shim.js:1113 :14TemplateParseVisitor< /TemplateParseVisitor.prototype._createDirectiveAsts@http://本地主机:53861 / LIB / anguar2 / angular2.dev.js:24301:27TemplateParseVisito为r /TemplateParseVisitor.prototype.visitElement@http://本地主机:53861 / LIB / anguar2 / angular2.dev.js:24154:24HtmlElementAst< /HtmlElementAst.prototype.visit@http://本地主机:53861 / LIB / anguar2 / angular2.dev.js:20216:14htmlVisitAll /< @http://本地主机:53861 / LIB / anguar2 / angular2.dev.js:20227:23forEach @ HTTP://本地主机:53861 / LIB / ES6-垫片/ ES6 -shim.js:1107:14htmlVisitAll @ HTTP://本地主机:53861 / LIB / anguar2 / angular2.dev.js:20226:5TemplateParser< /TemplateParser.prototype.parse@http://本地主机:53861 / LIB / anguar2 / angular2.dev.js:24038:20TemplateCompiler< /TemplateCompiler.prototype._compileComponentRuntime/done< @http://本地主机:53861 / LIB / anguar2 / angular2.dev.js:24669:32run @ HTTP://本地主机:53861 / LIB / anguar2 / angular2-polyfills.js:138:14NgZone< /NgZone.prototype._createInnerZone/< $运行/< @ [...]  

SAFARI

  EXCEPTION:在BrowserDetails实例化时出错! (Token Promise< ComponentRef>  - > DynamicComponentLoader  - > Compiler  - > RuntimeCompiler  - > ProtoViewFactory  - > Renderer  - > DomRenderer  - > AnimationBuilder  - > BrowserDetails).angular2.dev.js:23514ORIGINAL EXCEPTION:TypeError :'undefined'不是函数(评估'window.requestAnimationFrame(callback)') 

 可能未处理的拒绝[2]错误:EXCEPTION:BrowserDetails实例化时出错! (Token Promise< ComponentRef>  - > DynamicComponentLoader  - > Compiler  - > RuntimeCompiler  - > ProtoViewFactory  - > Renderer  - > DomRenderer  - > AnimationBuilder  - > BrowserDetails).ORIGINAL EXCEPTION:TypeError:'undefined'is not一个函数(评估'window.requestAnimationFrame(callback)')加载http:// localhost:53861 / app / bootDesktop.js  






任何关于什么是错误的想法非常感谢。它看起来像是与BrowserDomAdapter有关。

解决方案

通过升级es6-shim来解决问题。

App works fine in Chrome and IE(11), but not in Firefox (42.0) or Safari (5.1.7).

FIREFOX:

mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create es6-shim.js:1338:11

Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode. angular2.dev.js:351:5

EXCEPTION: Error: Expected int32 as second argument angular2.dev.js:23524

BrowserDomAdapter</BrowserDomAdapter.prototype.logError() angular2.dev.js:23514
BrowserDomAdapter</BrowserDomAdapter.prototype.logGroup() angular2.dev.js:23525
ExceptionHandler</ExceptionHandler.prototype.call() angular2.dev.js:1145
PlatformRef_</PlatformRef_.prototype._initApp/</<() angular2.dev.js:14801
NgZone</NgZone.prototype._notifyOnError() angular2.dev.js:5796
NgZone</NgZone.prototype._createInnerZone/errorHandling<.onError() angular2.dev.js:5700
run() angular2-polyfills.js:141

map@http://localhost:53861/lib/es6-shim/es6-shim.js:1113:14
TemplateParseVisitor</TemplateParseVisitor.prototype._createDirectiveAsts@http://localhost:53861/lib/anguar2/angular2.dev.js:24301:27
TemplateParseVisitor</TemplateParseVisitor.prototype.visitElement@http://localhost:53861/lib/anguar2/angular2.dev.js:24154:24
HtmlElementAst</HtmlElementAst.prototype.visit@http://localhost:53861/lib/anguar2/angular2.dev.js:20216:14
htmlVisitAll/<@http://localhost:53861/lib/anguar2/angular2.dev.js:20227:23
forEach@http://localhost:53861/lib/es6-shim/es6-shim.js:1107:14
htmlVisitAll@http://localhost:53861/lib/anguar2/angular2.dev.js:20226:5
TemplateParser</TemplateParser.prototype.parse@http://localhost:53861/lib/anguar2/angular2.dev.js:24038:20
TemplateCompiler</TemplateCompiler.prototype._compileComponentRuntime/done<@http://localhost:53861/lib/anguar2/angular2.dev.js:24669:32
run@http://localhost:53861/lib/anguar2/angular2-polyfills.js:138:14
NgZone</NgZone.prototype._createInnerZone/<.$run/<@[…]

SAFARI:

EXCEPTION: Error during instantiation of BrowserDetails! (Token Promise<ComponentRef> -> DynamicComponentLoader -> Compiler -> RuntimeCompiler -> ProtoViewFactory -> Renderer -> DomRenderer -> AnimationBuilder -> BrowserDetails).
angular2.dev.js:23514ORIGINAL EXCEPTION: TypeError: 'undefined' is not a function (evaluating 'window.requestAnimationFrame(callback)')

Potentially unhandled rejection [2] Error: EXCEPTION: Error during instantiation of BrowserDetails! (Token Promise<ComponentRef> -> DynamicComponentLoader -> Compiler -> RuntimeCompiler -> ProtoViewFactory -> Renderer -> DomRenderer -> AnimationBuilder -> BrowserDetails).
ORIGINAL EXCEPTION: TypeError: 'undefined' is not a function (evaluating 'window.requestAnimationFrame(callback)')
	Error loading http://localhost:53861/app/bootDesktop.js


Any ideas as to what is wrong greatly appreciated. It looks like it has something to do with "BrowserDomAdapter".

解决方案

issue resolved by upgrade the es6-shim.

这篇关于Angular2应用程序在Chrome和IE中可用,但不能用于Firefox或Safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 14:14