100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
TypeScript

Angular Router Basics

Learn how Angular's built-in router maps URL paths to components, enabling single-page applications to feel like multi-page sites without full page reloads.

Routing with the Angular RouterBeginner9 min readJul 9, 2026
Analogies

Angular Router Basics

The Angular Router is a client-side navigation library that maps URL paths to components, letting you build a single-page application (SPA) that feels like a traditional multi-page site. Instead of the browser requesting a new HTML document from the server on every navigation, the router intercepts URL changes, matches them against a list of route definitions, and swaps out the components rendered inside a <router-outlet>. This preserves application state, avoids full page reloads, and lets you build rich transitions between views. In modern Angular (17+), routes are typically configured as a flat array of Routes objects and provided to the application via provideRouter() in a standalone bootstrapApplication() call, replacing the older RouterModule.forRoot() NgModule pattern.

🏏

Cricket analogy: Just as a stadium's giant screen swaps replays without the crowd leaving their seats, the Angular Router swaps components inside a router-outlet without the browser fetching a fresh page from the server, like Eden Gardens showing DRS reviews instantly.

Defining Routes

A route is an object with a path (the URL segment to match, without a leading slash) and either a component (for standalone components) or a loadComponent/loadChildren function for lazy loading. Routes are matched in array order, top to bottom, so more specific paths should generally be listed before more general ones like wildcard ** catch-alls. The empty string path '' matches the root of that route level, which is commonly used for a default/home view.

🏏

Cricket analogy: A route's path is like a fielding position such as gully assigned on the scorecard, matched in the order captains set the field, so a specific catching position must be listed before a generic sweeper else the sweeper claims every ball.

typescript
// app.routes.ts
import { Routes } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { NotFoundComponent } from './not-found/not-found.component';

export const routes: Routes = [
  { path: '', component: HomeComponent, title: 'Home' },
  { path: 'about', component: AboutComponent, title: 'About Us' },
  { path: '**', component: NotFoundComponent, title: 'Page Not Found' },
];

// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { provideRouter } from '@angular/router';
import { AppComponent } from './app/app.component';
import { routes } from './app/app.routes';

bootstrapApplication(AppComponent, {
  providers: [provideRouter(routes)],
});

<router-outlet> is a placeholder directive that marks where the router should render the component matching the active route. A component template navigates between routes declaratively using the routerLink directive rather than plain <a href> tags, which avoids full-page reloads that href would otherwise trigger. routerLinkActive applies a CSS class automatically when a link's route is currently active, which is the standard way to highlight the current navigation item without manual state tracking.

🏏

Cricket analogy: router-outlet is like the stump camera slot that always shows whichever bowler is currently up, while routerLink is like a scorer clicking a player's name on the digital board instead of manually rewriting the scoreboard each over.

typescript
import { Component } from '@angular/core';
import { RouterOutlet, RouterLink, RouterLinkActive } from '@angular/router';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [RouterOutlet, RouterLink, RouterLinkActive],
  template: `
    <nav>
      <a routerLink="/" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">Home</a>
      <a routerLink="/about" routerLinkActive="active">About</a>
    </nav>
    <router-outlet />
  `,
})
export class AppComponent {}

Unlike React Router, which is a third-party library with several competing versions and APIs, the Angular Router is a first-party, officially maintained package (@angular/router) that ships as part of the framework and is the de facto standard — there is no ecosystem fragmentation to navigate.

Programmatic Navigation

Beyond template-driven routerLink, you can navigate imperatively from component code by injecting the Router service (commonly via the inject() function) and calling router.navigate(['/path']) or router.navigateByUrl('/path'). This is essential after actions like form submission or authentication, where navigation should happen as a side effect of logic rather than a user clicking a link.

🏏

Cricket analogy: It's like a captain deciding to review a decision imperatively after a huddle with teammates rather than waiting for the batsman to signal, matching how router.navigate() fires programmatically after logic like a wicket review completes.

A common beginner mistake is forgetting that router.navigate() takes an array of path segments (a 'link parameters array'), e.g. router.navigate(['/users', userId]), not a single interpolated string. Passing a malformed array silently produces an incorrect URL rather than throwing a compile error.

  • The Angular Router maps URL paths to components without triggering full page reloads.
  • Routes are configured as a Routes array and registered with provideRouter() in bootstrapApplication().
  • <router-outlet> is the placeholder where the matched route's component renders.
  • Use routerLink for declarative navigation and routerLinkActive to style the active link.
  • Inject the Router service to navigate programmatically with navigate() or navigateByUrl().
  • Route order matters — Angular matches top-down, so wildcard ** routes must come last.

Practice what you learned

Was this page helpful?

Topics covered

#TypeScript#AngularStudyNotes#WebDevelopment#AngularRouterBasics#Angular#Router#Defining#Routes#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse