Created
July 10, 2023 12:02
-
-
Save NyaGarcia/8b2e8f8a964cf1a56664477f1297ab1b to your computer and use it in GitHub Desktop.
Configuring the router to automatically bind router state information to component inputs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RouterModule, Routes, provideRouter, withComponentInputBinding } from '@angular/router'; | |
import { NgModule } from '@angular/core'; | |
import { PokemonListComponent } from './pokemon-list/pokemon-list.component'; | |
const routes: Routes = [ | |
{ path: '', pathMatch: 'full', redirectTo: 'pokemon' }, | |
{ path: 'pokemon', component: PokemonListComponent }, | |
]; | |
@NgModule({ | |
imports: [RouterModule.forRoot(routes)], | |
exports: [RouterModule], | |
providers: [provideRouter(routes, withComponentInputBinding())], | |
}) | |
export class AppRoutingModule {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment