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 (20)

PDF
Where and Why Use Angular for Web Development?
PDF
Java Desktop 2019
PDF
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
PDF
Naga Muruga (1.6 Years) Developer Resume
PPTX
Net fest final presentation
PPTX
.NET Fest 2019. Alexandre Malavasi. The future of Web: what Microsoft Blazor ...
PDF
Evolution and History of Angular as Web Development Platform.pdf
DOCX
Crown Hill IT Solutions Build progressive web apps with angular.docx
PPTX
Angular Js Advantages - Complete Reference
PPTX
Module 1.pptx Angular JS FRAMEWORK WEBDEVELOPMENT
PDF
What’s new in angular 13 and why should you use it for web app development pr...
PDF
The Power of Angular: 10 Reasons Why Web Developers Should Embrace It in 2024
PDF
Beginner's Guide to Angular 2.0
PDF
Angular, the New Angular JS
PDF
Webpack and angularjs
PDF
Angular & Webpack — Nir Kaufman
PPTX
AngularJS Training in Noida
PDF
Top Reasons to use the Angular Framework for developing Applications!
PDF
Essential Angular Development Features that Benefit Businesses
PDF
AngularJS best-practices
Where and Why Use Angular for Web Development?
Java Desktop 2019
Using Angular-CLI to Deploy an Angular 2 App Using Firebase in 30 Minutes
Naga Muruga (1.6 Years) Developer Resume
Net fest final presentation
.NET Fest 2019. Alexandre Malavasi. The future of Web: what Microsoft Blazor ...
Evolution and History of Angular as Web Development Platform.pdf
Crown Hill IT Solutions Build progressive web apps with angular.docx
Angular Js Advantages - Complete Reference
Module 1.pptx Angular JS FRAMEWORK WEBDEVELOPMENT
What’s new in angular 13 and why should you use it for web app development pr...
The Power of Angular: 10 Reasons Why Web Developers Should Embrace It in 2024
Beginner's Guide to Angular 2.0
Angular, the New Angular JS
Webpack and angularjs
Angular & Webpack — Nir Kaufman
AngularJS Training in Noida
Top Reasons to use the Angular Framework for developing Applications!
Essential Angular Development Features that Benefit Businesses
AngularJS best-practices

Recently uploaded (20)

PDF
COLEAD A2F approach and Theory of Change
PPTX
Anesthesia and it's stage with mnemonic and images
PPTX
Emphasizing It's Not The End 08 06 2025.pptx
PPTX
BIOLOGY TISSUE PPT CLASS 9 PROJECT PUBLIC
PDF
Nykaa-Strategy-Case-Fixing-Retention-UX-and-D2C-Engagement (1).pdf
PPTX
An Unlikely Response 08 10 2025.pptx
PPTX
Project and change Managment: short video sequences for IBA
PPTX
Relationship Management Presentation In Banking.pptx
PPTX
Effective_Handling_Information_Presentation.pptx
PPTX
chapter8-180915055454bycuufucdghrwtrt.pptx
PPTX
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
PPTX
nose tajweed for the arabic alphabets for the responsive
PPTX
Tablets And Capsule Preformulation Of Paracetamol
DOC
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
PDF
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
PPTX
lesson6-211001025531lesson plan ppt.pptx
PPTX
Introduction-to-Food-Packaging-and-packaging -materials.pptx
PPTX
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
DOCX
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
PPTX
Hydrogel Based delivery Cancer Treatment
COLEAD A2F approach and Theory of Change
Anesthesia and it's stage with mnemonic and images
Emphasizing It's Not The End 08 06 2025.pptx
BIOLOGY TISSUE PPT CLASS 9 PROJECT PUBLIC
Nykaa-Strategy-Case-Fixing-Retention-UX-and-D2C-Engagement (1).pdf
An Unlikely Response 08 10 2025.pptx
Project and change Managment: short video sequences for IBA
Relationship Management Presentation In Banking.pptx
Effective_Handling_Information_Presentation.pptx
chapter8-180915055454bycuufucdghrwtrt.pptx
ART-APP-REPORT-FINctrwxsg f fuy L-na.pptx
nose tajweed for the arabic alphabets for the responsive
Tablets And Capsule Preformulation Of Paracetamol
学位双硕士UTAS毕业证,墨尔本理工学院毕业证留学硕士毕业证
Tunisia's Founding Father(s) Pitch-Deck 2022.pdf
lesson6-211001025531lesson plan ppt.pptx
Introduction-to-Food-Packaging-and-packaging -materials.pptx
AcademyNaturalLanguageProcessing-EN-ILT-M02-Introduction.pptx
"Project Management: Ultimate Guide to Tools, Techniques, and Strategies (2025)"
Hydrogel Based delivery Cancer Treatment

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