Angular2 – Error: The selector “app-root” did not match any elements

Angular starts with a root component. When you give

bootstrap: [ AppComponent ]

in your app.modules.ts, angular searches for first instance of app-root in your HTML and replaces that tag with angular application.
So, your AppComponent selector should match to the root component in HTML .

You need to add other component code inside app.component.html , so that angular can display them . It follows tree structure where app-root is at the top .

Leave a Comment