A comprehensive task management system built with Angular featuring full CRUD operations, reactive forms, and proper error handling.
- Create Tasks: Add new tasks with title, description, and status
- Read Tasks: View all tasks or filter by status
- Update Tasks: Edit existing tasks or change their status
- Delete Tasks: Remove tasks with confirmation
- Clean, modern, and responsive design
- Card-based task display
- Intuitive form interface
- Loading spinners for async operations
- Error messages with clear feedback
- Status badges with color coding
- TypeScript Interfaces: Type-safe data models (
Task,TaskStatus,TaskFormData) - Angular Service: Centralized API communication with error handling
- Reactive Forms: Form validation and error messages
- RxJS Observables: Proper async handling with cleanup
- Loading States: Visual feedback for all async operations
- Error Handling: Comprehensive error catching and user feedback
frontend/src/app/
├── models/
│ └── task.model.ts # TypeScript interfaces and enums
├── services/
│ └── task.service.ts # HTTP service for API calls
└── components/
├── task-list/
│ ├── task-list.component.ts
│ ├── task-list.component.html
│ └── task-list.component.css
└── task-form/
├── task-form.component.ts
├── task-form.component.html
└── task-form.component.css
Main container component that:
- Displays all tasks in a card layout
- Provides filtering by status
- Handles task deletion
- Manages inline status updates
- Shows/hides the task form
- Displays loading and error states
Reusable form component for creating and editing tasks:
- Reactive form with validation
- Required field validation
- Min/max length validation
- Real-time error messages
- Loading state during submission
- Supports both create and edit modes
Comprehensive service providing:
getTasks(): Fetch all tasksgetTasksByStatus(status): Filter tasks by statusgetTask(id): Get single taskcreateTask(data): Create new taskupdateTask(id, data): Update entire taskpatchTask(id, updates): Partial updatedeleteTask(id): Remove taskloading$: Observable for loading state- Centralized error handling
interface Task {
id?: string;
title: string;
description: string;
status: TaskStatus;
createdAt: string;
updatedAt?: string;
}enum TaskStatus {
TODO = 'todo',
IN_PROGRESS = 'in-progress',
DONE = 'done'
}- Required
- Minimum length: 3 characters
- Maximum length: 100 characters
- Required
- Minimum length: 10 characters
- Maximum length: 500 characters
- Required
- Must be one of: todo, in-progress, done
The application connects to the mock API at http://localhost:3001/tasks
-
Start the mock API server:
cd mock-api npm install npm start -
The API should be running on
http://localhost:3001
GET /tasks- Fetch all tasksGET /tasks?status=<status>- Filter by statusGET /tasks/:id- Get single taskPOST /tasks- Create taskPUT /tasks/:id- Update taskPATCH /tasks/:id- Partial updateDELETE /tasks/:id- Delete task
-
Start the Mock API (in one terminal):
cd mock-api npm start -
Start the Frontend (in another terminal):
cd frontend npm install npm start -
Access the application:
- Open browser to
http://localhost:4200 - Navigate to the "Tasks" link in the navigation
- Open browser to
- Click the "+ Add Task" button
- Fill in the form:
- Enter a title (3-100 characters)
- Enter a description (10-500 characters)
- Select a status
- Click "Create Task"
- Click the edit icon (✏️) on any task card
- Modify the fields as needed
- Click "Update Task"
- Use the status dropdown on any task card
- Select the new status
- The change is saved immediately
- Click the delete icon (🗑️) on any task card
- Confirm the deletion in the dialog
- The task is removed immediately
- Use the "Filter by status" dropdown
- Select a status or "All Tasks"
- The list updates immediately
The application handles various error scenarios:
- Display: "Unable to connect to the server. Please check if the API is running."
- Solution: Ensure mock API is running on port 3001
- Display: Real-time validation messages below form fields
- Solution: Follow the validation requirements
- 404: "Task not found"
- 400: "Invalid request. Please check your input"
- 500: "Server error. Please try again later"
- ✅ Reactive Forms for form handling
- ✅ Services for API calls
- ✅ Component separation (smart/presentational)
- ✅ Proper module imports
- ✅ Strong typing with interfaces
- ✅ Enums for constants
- ✅ Type safety throughout
- ✅ Proper subscription management
- ✅ takeUntil for cleanup
- ✅ Error handling in pipe
- ✅ finalize for loading states
- ✅ Loading indicators
- ✅ Error messages
- ✅ Confirmation dialogs
- ✅ Responsive design
- ✅ Immediate feedback
Potential improvements:
- Add task priorities
- Implement due dates
- Add task categories/tags
- Search functionality
- Sorting options
- Pagination for large lists
- Task details view
- Drag and drop for status changes
- Dark mode support
- Export tasks to CSV/JSON
- Check if mock API is running:
curl http://localhost:3001/tasks - Check browser console for errors
- Verify CORS is enabled on the API
- Check browser console for validation errors
- Ensure all required fields are filled
- Check if API is responding
- Clear browser cache
- Check if CSS files are loading
- Verify Angular CLI is serving files correctly
For issues or questions:
- Check the browser console for errors
- Verify all services are running
- Review the API documentation in
mock-api/README.md - Check Angular documentation for framework-specific issues
Built with Angular, TypeScript, and best practices for modern web development.