0

I have in app.component.html the layout for a side menu which englobes the real content of my app.

When I visit a link to get to a different page, I'd like that only the content of my app is reloaded, not the entire thing. For two reasons, one, the visual delay which makes the app seem slow, and two, it would be much easier for me to display the currently selected menu.

enter image description here

1 Answer 1

4

You have to use routing for this.

Basically, your app.component.html will contain these lines

<app-header></app-header>           // This will render the header component
<router-outlet></router-outlet>     // This will render all the route changes
<app-footer></app-footer>           // This will render the footer

Working Examples: Header and Footer don't reload, even the tabs selected are highlighted

My Portfolio
Angular Scaffolding // Take a look at this, you can even have a look at the code of how it works. Fork it all you want.

Reference

Angular Routing is a fairly large topic, deserving a whole page.

Take a look how it works: Angular.io Documentation

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks that was what I needed! Now as a side effect I have some API calls that aren't being rendered but I'll figure it out ^^
@JoaoVentura That's the spirit, anyways we are here to help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.