Live demo: https://mhdaxif.github.io/pokemon-app.
This project is a Pokémon List web application built with Angular and Angular Material. It allows users to search, view, and paginate through a list of Pokémon, mark favorites, and navigate to a detail page.
Make sure you have the following installed before setting up the project:
Angular CLI: Run the following command to install Angular CLI globally:
npm install -g @angular/cli
git clone https://github.com/mhdaxif/pokemon-app.git
cd pokemon-app
Install all necessary dependencies using npm
.
npm install
You can now start the Angular application using the following command:
ng serve
This will start a development server. Open your browser and go to http://localhost:4200/
to see the application in action.
└── 📁src
└── 📁app
└── 📁core
└── 📁guards
└── save-state.guard.ts
└── 📁services
└── app-state.service.ts
└── favorite.service.ts
└── index.ts
└── pokemon-details.service.ts
└── pokemon.service.ts
└── 📁features
└── 📁pokemon
└── 📁detail
└── detail.component.html
└── detail.component.scss
└── detail.component.spec.ts
└── detail.component.ts
└── 📁home
└── home.component.html
└── home.component.scss
└── home.component.spec.ts
└── home.component.ts
└── 📁shared
└── 📁components
└── 📁pagination
└── pagination.component.html
└── pagination.component.scss
└── pagination.component.spec.ts
└── pagination.component.ts
└── 📁pokemon-card
└── pokemon-card.component.html
└── pokemon-card.component.scss
└── pokemon-card.component.spec.ts
└── pokemon-card.component.ts
└── 📁models
└── Ability.ts
└── index.ts
└── Pokemon.ts
└── PokemonDetails.ts
└── PokemonListModel.ts
└── Statistics.ts
└── Type.ts
└── app.component.html
└── app.component.scss
└── app.component.spec.ts
└── app.component.ts
└── app.config.ts
└── app.routes.ts
└── material.module.ts
└── index.html
└── main.ts
└── styles.scss
Lazy Loading:
features
module are loaded lazily to improve initial load performance.pokemon
feature are set up for lazy loading.State Management:
save-state.guard.ts
: Favorite Management:
favorite.service.ts
: Core Services:
pokemon.service.ts
: pokemon-details.service.ts
: app-state.service.ts
: index.ts
(barrel file): Shared Components:
pokemon-card.component.ts
: pagination.component.ts
: Shared Models:
Pokemon.ts
, PokemonDetails.ts
, Ability.ts
, Statistics.ts
, Type.ts
, etc.: Routing:
app.routes.ts
: pokemon
feature components.Material Design:
material.module.ts
: App Configuration:
app.config.ts
: Styles:
styles.scss
: home.component.ts
)mat-card
, mat-paginator
, and mat-spinner
.pokemon-detail.component.ts
)pokemon.service.ts
)getPokemons()
to fetch paginated results and getPokemonDetails()
to fetch detailed information for individual Pokémon.mat-spinner
) is displayed when data is being fetched from the API.mat-paginator
, which is configured to control offset
and limit
for API requests.Search Pokémon: Type in the search bar at the top of the page to filter Pokémon by name.
Favorite Pokémon: Click on the heart icon to mark a Pokémon as a favorite. Use the filter button to only show favorites.
View Details: Click on a Pokémon card to view more details such as abilities, stats, and other information.
Pagination: Use the paginator at the bottom of the page to navigate through the Pokémon list.
src/styles.scss
.To create an optimized production build, use the following command:
ng build --prod
The build artifacts will be stored in the dist/
directory.