[Fixed] Angular routing problem. App.component content shows in every component

Issue

I have problem with showing app.component content on every component.
This is my app.component code:

enter image description here

I don’t want to share navbar and app-users to other components, but this content shows in every other components. Thank you for any help!

Solution

App routing is rendering besides navbar and users component then these two components will be rendered in any of the app routes. I suggest you make another component consisting navbar and users and add this to the application routing.
new.component.html will look like this:

 <app-navbar></app-navbar>
  <!-- other elemets --> 
 <app-users></app-users>

The app.component.html will look like this:

<router-outlet></router-outlet>

Leave a Reply

(*) Required, Your email will not be published