mirror of
https://github.com/angular/angular.git
synced 2026-11-23 07:05:14 -05:00
Consider the following template:
```html
<main>
@if (show) {
<span>text</span>
}
</main>
```
During hydration, Angular looks for the comment node that marks where the
`@if` block (or an `<ng-container>`) is. If the HTML from the server was
changed and this comment is missing, dev mode throws a clear NG0502 error.
But this check only runs in dev mode.
Prior to this fix, production continued with the missing comment and failed
later with a raw error that doesn't say what went wrong:
```
TypeError: Cannot set properties of null (setting '__ngContext__')
```
With this fix, production also throws NG0502.
(cherry picked from commit 551c446d98)