Join Justin Schwartzenberger for an in-depth discussion in this video Setting the base href and configuring routes, part of Angular 2 Essential Training.
- [Teacher] Angular has a module bundle named Router…for handling client-side routing.…To make use of routing in your Angular application,…you need to do a handful of things,…the first of which is setting up the base href in the dom.…The router makes use of the browser's history…push state for navigation and URL interaction.…This essentially allows for URLs to be used in a client…app without actually triggering a new remote request.…The client code can then work against those…state changes and make decisions of how to route.…
To support push state, you need to add a base href element…tag as a child of the head tag in your html dock.…So in the index.html file in the project, we need to add…a base tag and set the href attribute to a forward slash.…The next thing we need to do is create some routes.…Let's do that in a new file named…app.routing.ts in the app folder.…
We create a new variable named appRoutes…and set that equal to an array.…Now we're not gonna be needing to use this variable…in other files, so we don't need to export it here.…
Justin Schwartzenberger steps through the framework one feature at a time, focusing on the new component-based architecture of Angular 2. You'll learn what Angular is and what it can do, as Justin builds a full-featured web app from start to finish. After mastering the essentials, you can tackle the other project-based courses in our library and create your own Angular app.
- What is Angular?
- Setting up an Angular template
- Creating a component
- Binding events and properties
- Getting data to components
- Using directives and pipes
- Creating Angular forms
- Validating form data
- Understanding dependency injection
- Providing services
- Making HTTP calls
Skill Level Intermediate
Q: This course was updated on 03/01/2018. What changed?
A: The following topics were updated: directives and pipes, forms, dependency injection and services, HTTP, and routing.
1. Architecture Overview
3. Directives and Pipes
5. Dependency Injection and Services
Router links2m 36s
Next steps1m 20s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.