Skip to main content

Router basics and configuration

Learn Router basics and configuration (Module 10 · Angular Routing, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What is routing? • An Angular app is a single page application : the browser loads index.html once. Routing swaps which component is shown when the URL changes, without a full page reload, like changing TV channels while the TV stays on. • Java comparison: Spring MVC maps a URL to a controller method on the server; the Angular Router maps a URL to a component in the browser. • Three pieces: a routes array (the map), <router-outlet> (where the page appears) and RouterLink (clickable links).

More lessons in Module 10 · Angular Routing