Creating a routes.ts file that allows you to navigate between the two pages of the app.
- [Instructor] If you recall, we generated…three components in total.…A header component, a products component,…and an about component.…While we generated three, we only need…to create routes for two because…the header will always be present.…At the time of recording this video,…the Angular command line interface…does not support generating routes,…so we will have to do the work manually.…So, let's first create a file called app.routes.ts.…
Okay so inside we have to import three different modules…from two libraries.…So first,…we're going to import ModuleWithProviders…from the Angular core.…And then next we're going to import two different libraries,…Routes and RouterModule…from the Angular router.…
Next we have to import our components.…So we're going to import our AppComponent…from app.component.…And I'll just copy this.…And this next one we're going to import our AboutComponent,…and we'll change the location here as well…to /about/about.component.…
And we'll copy this.…And then finally, our ProductsComponent.…And this will be products, and finally products here.…
- How components work
- Defining HTML templates
- Defining CSS
- Class binding and style binding
- Property binding and event binding
- Creating routes for navigation
Skill Level Intermediate
Angular Essential Trainingwith Justin Schwartzenberger2h 48m Intermediate
Angular 2: Widget-Based Architectureswith Derek Peruo52m 18s Intermediate
1. Getting Up and Running with Angular
2. Templating Basics
3. Data Binding
5. Tying It All Together
- 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.