禁用角度路由事件

时间:2017-08-14 14:22:05

标签: angular logging

有没有办法在Angular 2/4中禁用platform-browser.es5.js的事件记录?我希望能够快速读取我自己的日志,并且Angular日志正在淹没我的。

Angular router logging

1 个答案:

答案 0 :(得分:38)

默认情况下,不记录路由事件。正如Maximus建议的那样,你必须在某处添加代码才能打开它们。您只需要删除该代码。

在我的应用程序中,我在应用程序路由模块中打开了路由事件:

    RouterModule.forRoot([
        { path: 'welcome', component: WelcomeComponent },
        { path: '', redirectTo: 'welcome', pathMatch: 'full' },
        { path: '**', component: PageNotFoundComponent }
    ], { enableTracing: true })

如果你有这样的代码,请删除enableTracing或将其设置为false。

相关问题