Overview
Paginator follows Angular 19’s best practices with a modular architecture that separates core functionality from feature modules. The project uses SCSS for styling and follows a component-based structure.Directory Structure
Module Organization
Core Module
Thecore.module.ts contains singleton services and shared functionality used throughout the application:
- Services: Global services like
LoadingServiceandThemeService - Interceptors: HTTP interceptors like
LoadingInterceptor - Components: Shared UI components like the loading indicator
src/app/core/core.module.ts
Paginator Feature Module
The main feature module (paginator.module.ts) encapsulates all pagination-related functionality:
- Components: Filters, header, pagination controls, and data table
- Services:
LocationsServicefor data management - Types: TypeScript interfaces and types (e.g.,
Location) - Pages: Route-level components like
HomeComponent
src/app/features/paginator/paginator.module.ts
Component Structure
Each component follows Angular’s standard structure:Key Components
- FiltersComponent: Handles data filtering UI
- PaginationComponent: Pagination controls and navigation
- TableComponent: Data table display
- HeaderComponent: Application header
- LoadingComponent: Global loading indicator
Services and Interceptors
Core Services
LoadingService (src/app/core/services/loading.service.ts):
- Manages global loading state
- Used by the loading interceptor
src/app/core/services/theme.service.ts):
- Handles theme switching functionality
Feature Services
LocationsService (src/app/features/paginator/services/locations.service.ts):
- Manages location data
- Handles API communication
- Provides data to paginator components
Interceptors
LoadingInterceptor (src/app/core/interceptors/loading.interceptor.ts):
- Intercepts HTTP requests
- Triggers loading indicator during API calls
Configuration Files
Angular Configuration
- angular.json: Build configuration, assets, styles, and scripts
- tsconfig.json: TypeScript compiler options
- tsconfig.app.json: App-specific TypeScript settings
- tsconfig.spec.json: Test-specific TypeScript settings
Application Configuration
- app.config.ts: Client-side application providers and configuration
- app.config.server.ts: Server-side rendering configuration
Routing
- app.routes.ts: Client-side route definitions
- app.routes.server.ts: Server-side route configuration for SSR
Assets
Static assets are organized in thesrc/assets/ directory:
- fonts/: Custom fonts (Comfortaa)
- images/: Application images
- logo/: Brand logos
Best Practices
- Separation of Concerns: Core functionality is separated from features
- Lazy Loading: Feature modules can be lazy-loaded for better performance
- Type Safety: TypeScript interfaces defined in
types/directories - Component Isolation: Each component has its own directory with all related files
- Environment Configuration: Separate configs for development and production