# Setting Up Routes — Angular Fundamentals: Components, Signals and Routing

Source: https://www.skillbyai.com/en/angular/ng-routing-basics

> Map URLs to components with a routes array, provideRouter, routerLink and router-outlet.

## Defining routes

A route array maps a URL `path` to a `component`. `provideRouter` wires it into the app.

```typescript
// app.routes.ts
export const routes: Routes = [
  { path: '', component: HomeComponent },
  { path: 'products', component: ProductListComponent },
];

// main.ts
bootstrapApplication(AppComponent, {
  providers: [provideRouter(routes)],
});
```

## routerLink

`routerLink` navigates without a full page reload, and `<router-outlet>` marks where the matched component renders.

```html
<nav>
  <a routerLink="/">Home</a>
  <a routerLink="/products">Products</a>
</nav>
<router-outlet></router-outlet>
```
