angular/aio/content/errors/NG05104.md
Matthieu Riegler 0522f1b353 docs: Add a doc for NG5014 (#50567)
Short explanation this help fix the `Root node not found` error

PR Close #50567
2023-06-27 15:57:23 -07:00

33 lines
No EOL
767 B
Markdown

@name Root element was not found.
@category runtime
@shortDescription Root element was not found during bootstrap.
@description
Boostraped components are defined in the `bootstrap` property of an `@NgModule` decorator or as the first parameter of `boopstrapApplication` for standalone components.
This error happens when Angular tries to boostrap one of these components but cannot find its corresponing node in the DOM.
@debugging
This issue occurs when the selector mismatches the tag
```typescript
@Component({
selector: 'my-app',
...
})
class AppComponent {}
```
```html
<html>
<app-root></app-root> <!-- Doesn't match the selector -->
</html>
```
Replace the tag with the correct one:
```html
<html>
<my-app></my-app> <!-- OK -->
</html>
```