The RouterOutlet Placeholder

In this lesson, we'll learn how to use the RouterOutlet element to load a component for a route.

We’re able to load the <app-home-main> component in the app’s template. However, it’s not what we’re aiming for. We want to load it if the client is requesting the homepage. The Angular Router can help us with this. First, we’ll need to make some modifications to our modules.

Understanding routing

Routing is the idea of tying components to a path in the URL. URLs are mainly comprised of a domain and a path.

Other things make up a URL, but I’m keeping it simple to explain how routes work. The path portion of a URL is where we request specific resources from a server. When the server serves our application, Angular will grab the path from the URL. It will match the path against the ...