SlideShare a Scribd company logo
Enterprise Software Development
Join the Conversation #AngularHackDay @jernej_kavka
Melbourne - Angular Hack Day 2019
An introduction to
Routing in Angular
Join the Conversation #AngularHackDay @jernej_kavka
Senior Software Architect at SSW
Jernej Kavka (JK)
@Jernej_kavka
https://github.com/jernejk
https://jkdev.me
https://opencollective.com/jernej-kavka
Focusing on .NET Core, Cognitive Services and ML.NET
Join the Conversation #AngularHackDay @jernej_kavka
Get started
Navigate with arguments
Navigate to a new page
Table of
Contents
Get started
• Create Angular application with routing
• Use ng new
• Angular CLI will ask you if you want routing
Join the Conversation #AngularHackDay @jernej_kavka
Add app-routing.module.ts in src folder
Manually enabling routing
Join the Conversation #AngularHackDay @jernej_kavka
Manually enabling routing
In app.module.ts, update as follows
Join the Conversation #AngularHackDay @jernej_kavka
Manually enabling routing
Lastly, in app.module.html, update as follows
Join the Conversation #AngularHackDay @jernej_kavka
Navigate to a new page
• Create new component
ng generate component Democracy
• Add a route in app-routing.module.ts
{ path: 'democracy', component: DemocracyComponent }
• Add a link in the menu in app.component.html
<a [routerLink]="'democracy'">Who will sit on Iron Throne?</a>
Join the Conversation #AngularHackDay @jernej_kavka
The Game of Thrones
Join the Conversation #AngularHackDay @jernej_kavka
?
Navigate with arguments
• Add routing to Iron Throne page
• { path: 'iron-throne/:id', component: IronThroneComponent }
• Add a link to Irone Throne page
• <a [routerLink]="['/iron-throne', character.id]">
• Get the character ID
• In constructor: private route: ActivatedRoute
• const id = this.route.snapshot.paramMap.get('id');
• Display the character as the rightful ruler
Join the Conversation #AngularHackDay @jernej_kavka
Other ways to navigate
• In HTML:
• <a [routerLink]="['/iron-throne', character.id]">
• In Code:
• In constructor: private router: Router
• this.router.navigate(['/iron-throne’, character.id]);
Join the Conversation #AngularHackDay @jernej_kavka
Learn more about Routing:
angular.io/guide/router
Thank you!
info@ssw.com.au
www.ssw.com.au
Sydney | Melbourne | Brisbane

More Related Content

PDF
How to use apolloJS on React ?
PDF
Hybrid Apps, Ionic framework
PPTX
Angular Ivy- An Overview
PDF
Angular Day 2018 (italy) - Keynote - The Amazing World of Angular 6
PPTX
Building a scalable app factory with Appcelerator Platform
PPTX
Angular2 + New Firebase in Action
PPTX
GAB2017 - Azure function to build serverless SharePoint apps
PPTX
Devnest 110802
How to use apolloJS on React ?
Hybrid Apps, Ionic framework
Angular Ivy- An Overview
Angular Day 2018 (italy) - Keynote - The Amazing World of Angular 6
Building a scalable app factory with Appcelerator Platform
Angular2 + New Firebase in Action
GAB2017 - Azure function to build serverless SharePoint apps
Devnest 110802

What's hot (20)

PPTX
Deploying Apps Heroku
PDF
React Native - Getting Started
PPT
echo-o & Google App Engine dev - BarCamp Saigon 1
PDF
Devoxx be-2017-react-j hipster
PDF
Getting developers hooked on your api
PDF
apidays LIVE Hong Kong 2021 - Better API DX with a CLI by Phil Nash, Twilio
PPTX
PDF
Are you ready to adopt GraphQL?
PDF
Paco van Beckhoven - Keeping your head cool with a serverless voice controlle...
PPTX
Making share point rock with angular and react
PDF
API first approach for frontend developers
PPTX
Jenkins pipelines
PDF
Testing Your APIs: Postman, Newman, and Beyond
PDF
Novidades Angular 4.x e CLI
PPTX
Hands on react native
PDF
Laravel & google cloud platform do mix​!
PDF
Creating real time applications with Angular and Firebase
PPTX
API-first development
PPTX
Angular From The Trenches - 10 Lessons
PPTX
WordPress + react
Deploying Apps Heroku
React Native - Getting Started
echo-o & Google App Engine dev - BarCamp Saigon 1
Devoxx be-2017-react-j hipster
Getting developers hooked on your api
apidays LIVE Hong Kong 2021 - Better API DX with a CLI by Phil Nash, Twilio
Are you ready to adopt GraphQL?
Paco van Beckhoven - Keeping your head cool with a serverless voice controlle...
Making share point rock with angular and react
API first approach for frontend developers
Jenkins pipelines
Testing Your APIs: Postman, Newman, and Beyond
Novidades Angular 4.x e CLI
Hands on react native
Laravel & google cloud platform do mix​!
Creating real time applications with Angular and Firebase
API-first development
Angular From The Trenches - 10 Lessons
WordPress + react

Similar to Angular Routing - Angular Hack Day Melbourne 2019 (14)

PPTX
UQ21CA642BA1-Unit-3-WAF-Class18-Introduction to Angular Routing.pptx
ODP
Routing & Navigating Pages in Angular 2
PDF
Angular routing
PDF
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
DOCX
Understand routing in angular 2
PPTX
Angular2 routing
PDF
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
PDF
Angular_BootStrap.pdf
PDF
Angular 2 MVD workshop
PPTX
ngNewRouter
PDF
Angular2 workshop
PPTX
Foster - Getting started with Angular
PDF
Angular components
PDF
Angular js routing options
UQ21CA642BA1-Unit-3-WAF-Class18-Introduction to Angular Routing.pptx
Routing & Navigating Pages in Angular 2
Angular routing
Angular Routing Tutorial | AngularJS vs Angular Router | Angular Training | E...
Understand routing in angular 2
Angular2 routing
How to Implement Basic Angular Routing and Nested Routing With Params in Angu...
Angular_BootStrap.pdf
Angular 2 MVD workshop
ngNewRouter
Angular2 workshop
Foster - Getting started with Angular
Angular components
Angular js routing options

Recently uploaded (20)

PPTX
Project and change Managment: short video sequences for IBA
PPTX
fundraisepro pitch deck elegant and modern
PPTX
2025-08-10 Joseph 02 (shared slides).pptx
PDF
Parts of Speech Prepositions Presentation in Colorful Cute Style_20250724_230...
PPTX
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
PPTX
Anesthesia and it's stage with mnemonic and images
PPTX
_ISO_Presentation_ISO 9001 and 45001.pptx
PPTX
Presentation for DGJV QMS (PQP)_12.03.2025.pptx
PPTX
Intro to ISO 9001 2015.pptx wareness raising
PPTX
worship songs, in any order, compilation
PPTX
Primary and secondary sources, and history
PPT
First Aid Training Presentation Slides.ppt
PPTX
Self management and self evaluation presentation
PPTX
chapter8-180915055454bycuufucdghrwtrt.pptx
PPTX
Non-Verbal-Communication .mh.pdf_110245_compressed.pptx
PPTX
The Effect of Human Resource Management Practice on Organizational Performanc...
PPTX
Human Mind & its character Characteristics
PPT
The Effect of Human Resource Management Practice on Organizational Performanc...
PDF
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
PPTX
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx
Project and change Managment: short video sequences for IBA
fundraisepro pitch deck elegant and modern
2025-08-10 Joseph 02 (shared slides).pptx
Parts of Speech Prepositions Presentation in Colorful Cute Style_20250724_230...
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
Anesthesia and it's stage with mnemonic and images
_ISO_Presentation_ISO 9001 and 45001.pptx
Presentation for DGJV QMS (PQP)_12.03.2025.pptx
Intro to ISO 9001 2015.pptx wareness raising
worship songs, in any order, compilation
Primary and secondary sources, and history
First Aid Training Presentation Slides.ppt
Self management and self evaluation presentation
chapter8-180915055454bycuufucdghrwtrt.pptx
Non-Verbal-Communication .mh.pdf_110245_compressed.pptx
The Effect of Human Resource Management Practice on Organizational Performanc...
Human Mind & its character Characteristics
The Effect of Human Resource Management Practice on Organizational Performanc...
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
PHIL.-ASTRONOMY-AND-NAVIGATION of ..pptx

Angular Routing - Angular Hack Day Melbourne 2019

  • 1. Enterprise Software Development Join the Conversation #AngularHackDay @jernej_kavka
  • 2. Melbourne - Angular Hack Day 2019 An introduction to Routing in Angular Join the Conversation #AngularHackDay @jernej_kavka
  • 3. Senior Software Architect at SSW Jernej Kavka (JK) @Jernej_kavka https://github.com/jernejk https://jkdev.me https://opencollective.com/jernej-kavka Focusing on .NET Core, Cognitive Services and ML.NET Join the Conversation #AngularHackDay @jernej_kavka
  • 4. Get started Navigate with arguments Navigate to a new page Table of Contents
  • 5. Get started • Create Angular application with routing • Use ng new • Angular CLI will ask you if you want routing Join the Conversation #AngularHackDay @jernej_kavka
  • 6. Add app-routing.module.ts in src folder Manually enabling routing Join the Conversation #AngularHackDay @jernej_kavka
  • 7. Manually enabling routing In app.module.ts, update as follows Join the Conversation #AngularHackDay @jernej_kavka
  • 8. Manually enabling routing Lastly, in app.module.html, update as follows Join the Conversation #AngularHackDay @jernej_kavka
  • 9. Navigate to a new page • Create new component ng generate component Democracy • Add a route in app-routing.module.ts { path: 'democracy', component: DemocracyComponent } • Add a link in the menu in app.component.html <a [routerLink]="'democracy'">Who will sit on Iron Throne?</a> Join the Conversation #AngularHackDay @jernej_kavka
  • 10. The Game of Thrones Join the Conversation #AngularHackDay @jernej_kavka ?
  • 11. Navigate with arguments • Add routing to Iron Throne page • { path: 'iron-throne/:id', component: IronThroneComponent } • Add a link to Irone Throne page • <a [routerLink]="['/iron-throne', character.id]"> • Get the character ID • In constructor: private route: ActivatedRoute • const id = this.route.snapshot.paramMap.get('id'); • Display the character as the rightful ruler Join the Conversation #AngularHackDay @jernej_kavka
  • 12. Other ways to navigate • In HTML: • <a [routerLink]="['/iron-throne', character.id]"> • In Code: • In constructor: private router: Router • this.router.navigate(['/iron-throne’, character.id]); Join the Conversation #AngularHackDay @jernej_kavka
  • 13. Learn more about Routing: angular.io/guide/router