ng-pokemon-app/src/app/pokemon/pokemon.module.ts

57 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

2023-02-24 13:54:17 +00:00
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BorderCardDirective } from './border-card.directive';
import { PokemonTypeColorPipe } from './pokemon-type-color.pipe';
import { ListPokemonComponent } from './list-pokemon/list-pokemon.component';
import { DetailPokemonComponent } from './detail-pokemon/detail-pokemon.component';
import { RouterModule, Routes } from '@angular/router';
2023-02-24 14:12:39 +00:00
import { PokemonService } from './pokemon.service';
2023-02-24 15:57:25 +00:00
import { FormsModule } from '@angular/forms';
import { PokemonFormComponent } from './pokemon-form/pokemon-form.component';
import { EditPokemonComponent } from './edit-pokemon/edit-pokemon.component';
import { AddPokemonComponent } from './add-pokemon/add-pokemon.component';
2023-02-27 14:01:42 +00:00
import { SearchPokemonComponent } from './search-pokemon/search-pokemon.component';
import { LoaderComponent } from './loader/loader.component';
2023-02-27 14:58:23 +00:00
import { AuthGuard } from '../auth.guard';
2023-02-24 13:54:17 +00:00
const pokemonRoutes: Routes = [
2023-02-27 14:58:23 +00:00
{
path: 'edit/pokemon/:id',
component: EditPokemonComponent,
canActivate: [AuthGuard],
},
{
path: 'pokemon/add',
component: AddPokemonComponent,
canActivate: [AuthGuard],
},
{
path: 'pokemon/:id',
component: DetailPokemonComponent,
canActivate: [AuthGuard],
},
{
path: 'pokemons',
component: ListPokemonComponent,
canActivate: [AuthGuard],
},
2023-02-24 13:54:17 +00:00
];
@NgModule({
declarations: [
BorderCardDirective,
PokemonTypeColorPipe,
ListPokemonComponent,
DetailPokemonComponent,
2023-02-24 15:57:25 +00:00
PokemonFormComponent,
EditPokemonComponent,
AddPokemonComponent,
2023-02-27 14:01:42 +00:00
SearchPokemonComponent,
LoaderComponent,
2023-02-24 13:54:17 +00:00
],
2023-02-24 15:57:25 +00:00
imports: [CommonModule, FormsModule, RouterModule.forChild(pokemonRoutes)],
2023-02-24 14:12:39 +00:00
providers: [PokemonService],
2023-02-24 13:54:17 +00:00
})
export class PokemonModule {}