{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/17833","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/17833/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/17833/comments","events_url":"https://api.github.com/repos/angular/angular/issues/17833/events","html_url":"https://github.com/angular/angular/issues/17833","id":239429065,"number":17833,"title":"enableProdMode, If have any exception, the application will crash (don't re-display data when go to another router)","user":{"login":"Sophia-nguyen","id":11731312,"avatar_url":"https://avatars2.githubusercontent.com/u/11731312?v=3","gravatar_id":"","url":"https://api.github.com/users/Sophia-nguyen","html_url":"https://github.com/Sophia-nguyen","followers_url":"https://api.github.com/users/Sophia-nguyen/followers","following_url":"https://api.github.com/users/Sophia-nguyen/following{/other_user}","gists_url":"https://api.github.com/users/Sophia-nguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/Sophia-nguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sophia-nguyen/subscriptions","organizations_url":"https://api.github.com/users/Sophia-nguyen/orgs","repos_url":"https://api.github.com/users/Sophia-nguyen/repos","events_url":"https://api.github.com/users/Sophia-nguyen/events{/privacy}","received_events_url":"https://api.github.com/users/Sophia-nguyen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-29T10:09:17Z","updated_at":"2017-06-29T11:26:39Z","closed_at":null,"body":"Hi all,\r\nI use angular 2.1.2 and I need to customize ErrorHandler.\r\n\r\n\"AppModule.ts\":\r\n\r\n```\r\n@Injectable()\r\nclass MyErrorHandler implements ErrorHandler {\r\n    handleError(error) {\r\n        console.error(\"EXCEPTION:\", error.message);\r\n        console.error(\"EXCEPTION:\", error.stack);\r\n\r\n        setTimeout(() => {\r\n            location.href = \"#/error\";\r\n            return Observable.of([]);\r\n        });\r\n    }\r\n}\r\n```\r\nor\r\n\r\n```\r\n@Injectable()\r\nexport class MyErrorHandler {\r\n    private appRef;\r\n\r\n    constructor(private injector:Injector) {\r\n        setTimeout(() => this.appRef = injector.get(ApplicationRef));\r\n    }\r\n\r\n    handleError(exception) {\r\n        this.appRef.tick();\r\n        console.error('EXCEPTION:', exception);\r\n    }\r\n}\r\n```\r\nWhen I go to `/about` page and an error occurs. My app will redirect to `/error` page.\r\nThen I go to `/home` or another page. The data of this page don't show on template, just show template without any data.\r\nHow can I resolve it?"},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/311938658","html_url":"https://github.com/angular/angular/issues/17833#issuecomment-311938658","issue_url":"https://api.github.com/repos/angular/angular/issues/17833","id":311938658,"user":{"login":"Sophia-nguyen","id":11731312,"avatar_url":"https://avatars2.githubusercontent.com/u/11731312?v=3","gravatar_id":"","url":"https://api.github.com/users/Sophia-nguyen","html_url":"https://github.com/Sophia-nguyen","followers_url":"https://api.github.com/users/Sophia-nguyen/followers","following_url":"https://api.github.com/users/Sophia-nguyen/following{/other_user}","gists_url":"https://api.github.com/users/Sophia-nguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/Sophia-nguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sophia-nguyen/subscriptions","organizations_url":"https://api.github.com/users/Sophia-nguyen/orgs","repos_url":"https://api.github.com/users/Sophia-nguyen/repos","events_url":"https://api.github.com/users/Sophia-nguyen/events{/privacy}","received_events_url":"https://api.github.com/users/Sophia-nguyen/received_events","type":"User","site_admin":false},"created_at":"2017-06-29T11:26:39Z","updated_at":"2017-06-29T11:26:39Z","body":"Thanks @m98.\r\nI asked question on Stackoverflow but I don't have any solution, here is link: https://stackoverflow.com/questions/44758008/angular-2-when-exception-error-application-crashes-tempalte-dont-show-data\r\n\r\nand this is my router: \r\n\r\n```\r\nvar allRoutes = [\r\n        {path: \"home\",component: DashboardComponent},\r\n        {path: \"accounts\",loadChildren: 'app/components/account/AccountModule#AccountModule'},\r\n\t\t{path: \"about\",component: AboutComponent},\r\n        {path: \"error\",component: ErrorComponent}\r\n]\r\n\r\nconst routers = [{ path: '', canActivateChild: [CanActivateCustom], children: allRoutes }];\r\nexport const routing: ModuleWithProviders = RouterModule.forRoot(routers);\r\n\r\n```\r\n"}}
{"actor":{"display_login":"Sophia-nguyen"}}