What is the difference between routerLink and href?

Angular routing · Freshers

Model answer

A normal href makes the browser load a new page from the server, which restarts the app. routerLink tells the Angular router to change the route inside the running app, so it is fast and keeps state. routerLinkActive adds a class to the link of the current page, which is useful for menus.

Use routerLink for links inside your app, and href for external sites.

Learn this topic

Angular Tutorial: Beginner to Advanced .

Sign in to add your own answer.

More questions