Angular 2 TypeError:zone.addTask

时间:2016-02-03 13:24:45

标签: angular

我有一些代码巫婆停止工作......我不知道为什么。

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'}
])

直到上周五( 29.01.2016 ),现在在控制台中工作正常:

EXCEPTION: TypeError: zone.addTask is not a function

我的项目中有ZoneJS。

[编辑]

堆栈追踪:

  

TypeError:zone.addTask不是函数       在Zone。(匿名函数)(http://localhost:8081/prod/scripts.gz.js:11297:28)       在Zone.setTimeout(http://localhost:8081/prod/scripts.gz.js:26201:27)       在窗口。(匿名函数)(http://localhost:8081/prod/scripts.gz.js:11263:47)       在SafeSubscriber。 (http://localhost:8081/prod/scripts.gz.js:23249:63)       在SafeSubscriber.tryCatcher [as _next](http://localhost:8081/prod/scripts.gz.js:23899:32)       在SafeSubscriber.next(http://localhost:8081/prod/scripts.gz.js:23852:19)       在EventEmitter.Subject._finalNext(http://localhost:8081/prod/scripts.gz.js:23450:31)       在EventEmitter.Subject._next(http://localhost:8081/prod/scripts.gz.js:23442:19)       在EventEmitter.Subject.next(http://localhost:8081/prod/scripts.gz.js:23405:15)       在EventEmitter.emit(http://localhost:8081/prod/scripts.gz.js:23239:77

     

----- async gap -----错误       at _getStacktraceWithUncaughtError(http://localhost:8081/prod/scripts.gz.js:11857:30)       在Zone.fork(http://localhost:8081/prod/scripts.gz.js:11906:48)       在Zone.bind(http://localhost:8081/prod/scripts.gz.js:10833:54)       在bindArguments(http://localhost:8081/prod/scripts.gz.js:11016:37)       在lib $ es6 $ promise $ promise $$ Promise.obj。(匿名函数)[当时](http://localhost:8081/prod/scripts.gz.js:11028:47)       在lib $ es6 $ promise $ promise $$ Promise.catch(http://localhost:8081/prod/scripts.gz.js:10680:23)       在lib $ es6 $ promise $ promise $$ Promise.obj。(匿名函数)[as catch](http://localhost:8081/prod/scripts.gz.js:11028:35)       在Function.PromiseWrapper.catchError(http://localhost:8081/prod/scripts.gz.js:23293:30)       在RootRouter.Router._afterPromiseFinishNavigating(http://localhost:8081/prod/scripts.gz.js:42623:40)       在http://localhost:8081/prod/scripts.gz.js:42558:27

     

----- async gap -----错误       at _getStacktraceWithUncaughtError(http://localhost:8081/prod/scripts.gz.js:11857:30)       在Zone.fork(http://localhost:8081/prod/scripts.gz.js:11906:48)       在Zone.bind(http://localhost:8081/prod/scripts.gz.js:10833:54)       在bindArguments(http://localhost:8081/prod/scripts.gz.js:11016:37)       在lib $ es6 $ promise $ promise $$ Promise.obj。(匿名函数)[当时](http://localhost:8081/prod/scripts.gz.js:11028:47)       在RootRouter.Router.navigateByUrl(http://localhost:8081/prod/scripts.gz.js:42555:67)       在新的RootRouter(http://localhost:8081/prod/scripts.gz.js:42819:15)       在routerFactory(http://localhost:8081/prod/scripts.gz.js:42380:23)       在Injector._instantiate(http://localhost:8081/prod/scripts.gz.js:14048:28)       在Injector._instantiateProvider(http://localhost:8081/prod/scripts.gz.js:13996:26

     

----- async gap -----错误       at getStacktraceWithUncaughtError(http://localhost:8081/prod/scripts.gz.js:11857:30)       在Zone.fork(http://localhost:8081/prod/scripts.gz.js:11906:48)       在Zone.bind(http://localhost:8081/prod/scripts.gz.js:10833:54)       在bindArguments(http://localhost:8081/prod/scripts.gz.js:11016:37)       在lib $ es6 $ promise $ promise $$ Promise.obj。(匿名函数)[当时](http://localhost:8081/prod/scripts.gz.js:11028:47)       在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)       在Injector._instantiate(http://localhost:8081/prod/scripts.gz.js:14045:28)       在Injector._instantiateProvider(http://localhost:8081/prod/scripts.gz.js:13996:26)       在Injector._new(http://localhost:8081/prod/scripts.gz.js:13985:22

     

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

1 个答案:

答案 0 :(得分:1)

我查看了 zone.js 依赖项(版本0.5.10),我在addTask对象中看不到任何Zone方法(请参阅文件node_modules/zone.js/lib/zones/core.js)。

您是通过NgZone

在Angular应用程序中使用显式区域吗?

修改

在Angular2中,ZoneJs在node_modules/angular2/bundles/angular2-polyfills.js文件中提供。

亨利