2016-02-03 60 views
1

我有一些代碼女巫只是停止工作...我不知道爲什麼。Angular 2 TypeError:zone.addTask

HTML:

<a class="nav_link" [routerLink]="['RowList']"> 
    <svg><use xlink:href="#icon-list"></use></svg> 
    Lista 
</a> 

JS:

@RouteConfig([ 
    {path: '/UI/row/list', component: RowList, name: 'RowList'} 
]) 

它正常工作,直到上週五(2016年1月29日),現在在控制檯:

EXCEPTION: TypeError: zone.addTask is not a function 

我有ZoneJS在我的項目中。


[編輯]

堆棧跟蹤:

TypeError: zone.addTask is not a function at Zone.(anonymous function) (http://localhost:8081/prod/scripts.gz.js:11297:28) at Zone.setTimeout (http://localhost:8081/prod/scripts.gz.js:26201:27) at window.(anonymous function) (http://localhost:8081/prod/scripts.gz.js:11263:47) at SafeSubscriber. (http://localhost:8081/prod/scripts.gz.js:23249:63) at SafeSubscriber.tryCatcher [as _next] (http://localhost:8081/prod/scripts.gz.js:23899:32) at SafeSubscriber.next (http://localhost:8081/prod/scripts.gz.js:23852:19) at EventEmitter.Subject._finalNext (http://localhost:8081/prod/scripts.gz.js:23450:31) at EventEmitter.Subject._next (http://localhost:8081/prod/scripts.gz.js:23442:19) at EventEmitter.Subject.next (http://localhost:8081/prod/scripts.gz.js:23405:15) at EventEmitter.emit (http://localhost:8081/prod/scripts.gz.js:23239:77)

-----async gap----- Error at _getStacktraceWithUncaughtError (http://localhost:8081/prod/scripts.gz.js:11857:30) at Zone.fork (http://localhost:8081/prod/scripts.gz.js:11906:48) at Zone.bind (http://localhost:8081/prod/scripts.gz.js:10833:54) at bindArguments (http://localhost:8081/prod/scripts.gz.js:11016:37) at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as then] (http://localhost:8081/prod/scripts.gz.js:11028:47) at lib$es6$promise$promise$$Promise.catch (http://localhost:8081/prod/scripts.gz.js:10680:23) at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as catch] (http://localhost:8081/prod/scripts.gz.js:11028:35) at Function.PromiseWrapper.catchError (http://localhost:8081/prod/scripts.gz.js:23293:30) at RootRouter.Router._afterPromiseFinishNavigating (http://localhost:8081/prod/scripts.gz.js:42623:40) at http://localhost:8081/prod/scripts.gz.js:42558:27

-----async gap----- Error at _getStacktraceWithUncaughtError (http://localhost:8081/prod/scripts.gz.js:11857:30) at Zone.fork (http://localhost:8081/prod/scripts.gz.js:11906:48) at Zone.bind (http://localhost:8081/prod/scripts.gz.js:10833:54) at bindArguments (http://localhost:8081/prod/scripts.gz.js:11016:37) at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as then] (http://localhost:8081/prod/scripts.gz.js:11028:47) at RootRouter.Router.navigateByUrl (http://localhost:8081/prod/scripts.gz.js:42555:67) at new RootRouter (http://localhost:8081/prod/scripts.gz.js:42819:15) at routerFactory (http://localhost:8081/prod/scripts.gz.js:42380:23) at Injector._instantiate (http://localhost:8081/prod/scripts.gz.js:14048:28) at Injector._instantiateProvider (http://localhost:8081/prod/scripts.gz.js:13996:26)

-----async gap----- Error at getStacktraceWithUncaughtError (http://localhost:8081/prod/scripts.gz.js:11857:30) at Zone.fork (http://localhost:8081/prod/scripts.gz.js:11906:48) at Zone.bind (http://localhost:8081/prod/scripts.gz.js:10833:54) at bindArguments (http://localhost:8081/prod/scripts.gz.js:11016:37) at lib$es6$promise$promise$$Promise.obj.(anonymous function) [as then] (http://localhost:8081/prod/scripts.gz.js:11028:47) at DynamicComponentLoader.loadAsRoot (http://localhost:8081/prod/scripts.gz.js:26563:52) at di_1.provide.useFactory (http://localhost:8081/prod/scripts.gz.js:25405:48) at Injector._instantiate (http://localhost:8081/prod/scripts.gz.js:14045:28) at Injector._instantiateProvider (http://localhost:8081/prod/scripts.gz.js:13996:26) at Injector._new (http://localhost:8081/prod/scripts.gz.js:13985:22)

-----async gap----- Error at _getStacktraceWithUncaughtError (http://localhost:8081/prod/scripts.gz.js:11857:30) at Zone.fork (http://localhost:8081/prod/scripts.gz.js:11906:48) at NgZone.createInnerZone (http://localhost:8081/prod/scripts.gz.js:26128:15) at new NgZone (http://localhost:8081/prod/scripts.gz.js:25914:37) at createNgZone (http://localhost:8081/prod/scripts.gz.js:25428:13) at PlatformRef.application (http://localhost:8081/prod/scripts.gz.js:25529:34) at Object.bootstrap (http://localhost:8081/prod/scripts.gz.js:12022:65) at HTMLDocument.main (http://localhost:8081/prod/scripts.gz.js:56780:23) at Zone.run (http://localhost:8081/prod/scripts.gz.js:10858:25) at HTMLDocument.zoneBoundFn (http://localhost:8081/prod/scripts.gz.js:10835:27)

+0

您使用的是哪個版本的Angular2? –

+0

我以'angular @ 2.0.0-beta.0'開頭,但是即使我將'angular'升級到2.0.0-beta.2',它仍然不起作用 – Alcadur

+0

好的。你有什麼提示錯誤發生的地方? –

回答

1

我看看zone.js依賴(版本0.5.10),我看不到Zone對象中的任何addTask方法(請參閱文件node_modules/zone.js/lib/zones/core.js)。

您是否通過NgZone在您的Angular應用程序中明確使用區域?

編輯

在Angular2,ZoneJs在node_modules/angular2/bundles/angular2-polyfills.js文件內。

Thierry

+0

不,我剛剛輸入'zone.js/dist/zone-microtask'和'zone.js/dist/long-stack-trace-zone'。當我開始創建這個應用程序我從'https:// github.com/AngularClass/angular2-webpack-starter'提示 – Alcadur

+1

也許你可以嘗試使用文件:angular2-polyfills.js。它包含zonejs和反射元數據...我更新了我的答案... –