Files
Harshit-Sachdev/Week-4/Day-3/angular-routing.md

30 lines
715 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## Angular Routing Basics
### What is Routing?
Routing allows navigation between different views without reloading the page.
### Why Routing is Important?
- Improves user experience
- Supports Single Page Applications
- Makes applications structured
### Router Module Setup
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'about', component: AboutComponent }
];
### Router Outlet
<router-outlet></router-outlet>
### Navigation Links
<a routerLink="/home">Home</a>
### Practical Work Done
- Created routes
- Linked multiple components
- Used router-outlet
- Navigated without page reload
### Learning Outcome
Learned how Angular handles client-side navigation efficiently.