From the course: Building Angular and ASP.NET Web API Apps

Unlock this course with a free trial

Join today to access over 24,400 courses taught by industry experts.

Configure routing and navigation

Configure routing and navigation

- [Lecturer] In the last part, we did create all the application components. Now in this part, you'll learn how to set up routing in an Angular app and how to navigate between components when you, for example, click on a link, or even just change the application URL. Now per definition, routing is the mechanism that allows navigation between different components by mapping a URL path to a specific component. To better understand routing and navigation, let us go to our project. Now when we created the app, by default, there was this app.routes.ts. In this file, we need to basically define all the route mappings. We define the path, and then whenever user navigates to that path, we do define the component that is going to be rendered. Then this file gets used here in the app.config.ts and then the app.config gets used in the main.ts. And here in the main.ts, we basically said that whenever the app is bootstrapped or is started, we need to load the app.component as the first component…

Contents