I am working on global error handler in angular and requirement of my project is also to show a modal window on error, so that user can report if something is wrong and we can fix it. It works fine unless error happens in template. The change detection is basically broken in that case it doesn't update bindings, thus Material Modal Dialog is displayed empty. I tried to google around and checked all available data in ngDebugContext, but nothing could answer my question. Point is that in case error happens in template(or maybe we can know if change detection is generally dead) then I would just display alert. As last resort solution I will just create modal component with static template, where text will be hardcoded and display that in case of any unhandled error.
In the end we solved it by using the fact that change detection is broken and created an always hidden element in the modal using angular binding [hidden]='true'
, but as change detection is broken it will be ignored, so text inside it will be displayed and this way we can even show a very specific message when app really crashed like
<!-- This part is fallback for unhandled error which happens during change detection in the template -->
<div class='crash-error-heading' [hidden]='true'>
<h2>Something went really wrong</h2>
</div>
<!---->