A comprehensive showcase of all Angular form implementation approaches
🚀 Live Demo • 📖 Documentation • 🛠️ Setup
Compare Reactive Forms, Template-Driven Forms, and the modern Signals approach side by side
Angular Forms Showcase is an interactive web application that demonstrates four different approaches to building forms in Angular. Perfect for developers who want to understand the differences, benefits, and use cases of each form implementation strategy.
- Modern UI with gradient themes for each form type
- Real-time validation indicators and feedback
- Responsive design that works on all devices
- Live form status tracking with visual indicators
- Side-by-side comparisons of different approaches
- Real-world validation examples and patterns
- Best practices implementation for each method
- Performance insights and architectural decisions
Modern Angular with signal-based state management
// Signal-based validation messages
protected readonly emailError = computed(() => {
const control = this.form.get('email');
if (control?.errors?.['required']) return 'Email is required';
if (control?.errors?.['email']) return 'Invalid email format';
return '';
});- ✅ Signal-driven validation messages
- ✅ Computed properties for reactive UI updates
- ✅ Type-safe FormControl interfaces
- ✅ Modern Angular best practices
Traditional reactive forms approach
// Classic method-based validation
protected getEmailError(): string {
const control = this.form.get('email');
if (control?.errors?.['required']) return 'Email is required';
return '';
}- ✅ FormBuilder patterns
- ✅ Validator functions
- ✅ Traditional methods for error handling
- ✅ Backward compatibility
Simple, declarative form approach
<!-- Template-driven validation -->
<input [(ngModel)]="userData.email" #email="ngModel"
required email class="form-input">- ✅ Two-way data binding with ngModel
- ✅ Template reference variables
- ✅ HTML5 validation attributes
- ✅ Minimal component code
Hybrid approach combining templates with signals
// Signal-based state with template binding
protected readonly userData = signal<UserData>({
email: '', firstName: '', lastName: ''
});
protected readonly isEmailValid = computed(() => {
const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;
return emailRegex.test(this.userData().email);
});- ✅ Best of both worlds approach
- ✅ Signal-driven reactive state
- ✅ Template simplicity with modern reactivity
- ✅ Real-time status indicators
Each implementation includes:
- 📝 Comprehensive Validation: Required fields, email validation, min/max lengths, custom validators
- 🔄 Real-time Feedback: Instant validation messages and visual indicators
- 📱 Responsive Design: Mobile-first approach with adaptive layouts
- 🎨 Visual Feedback: Color-coded validation states and loading indicators
- ♿ Accessibility: ARIA labels, semantic HTML, keyboard navigation
- 🚀 Performance: Lazy-loaded components and optimized bundle sizes
- Angular 20 - Latest features including standalone components
- TypeScript 5.9 - Strict type checking and modern language features
- RxJS 7.8 - Reactive programming patterns
- Signals - Angular's modern reactivity system
- Angular CLI - Project scaffolding and build tools
- SCSS - Modern CSS with variables and mixins
- ESLint + Prettier - Code quality and formatting
- Karma + Jasmine - Unit testing framework
- GitHub Actions - Automated deployment pipeline
- GitHub Pages - Static site hosting
- Webpack - Module bundling and optimization
- Node.js 18+
- npm 9+
- Angular CLI 20+
# Clone the repository
git clone https://github.com/tmac12/angular-forms.git
# Navigate to project directory
cd angular-forms
# Install dependencies
npm install
# Start development server
npm startThe application will be available at http://localhost:4200/
npm start # Start development server
npm run build # Build for production
npm run build:gh-pages # Build for GitHub Pages deployment
npm test # Run unit tests
npm run lint # Run ESLintangular-forms/
├── 📁 src/app/
│ ├── 📁 components/
│ │ ├── 📁 form-selector/ # Landing page component
│ │ ├── 📁 reactive-form-signals/ # Reactive + Signals
│ │ ├── 📁 reactive-form-classic/ # Traditional reactive
│ │ ├── 📁 template-driven-form/ # Template-driven
│ │ ├── 📁 template-driven-form-signals/ # Hybrid approach
│ │ └── 📁 shared/ # Shared styles & utilities
│ ├── 📄 app.routes.ts # Lazy-loaded routing
│ └── 📄 app.config.ts # App configuration
├── 📁 .github/workflows/ # CI/CD pipeline
├── 📄 angular.json # Angular CLI config
└── 📄 package.json # Dependencies & scripts
// Lazy-loaded components for better performance
export const routes: Routes = [
{ path: '', redirectTo: '/home', pathMatch: 'full' },
{
path: 'reactive-signals',
loadComponent: () => import('./components/reactive-form-signals/...')
}
];// Modern reactive patterns with signals
protected readonly formData = signal<UserData | null>(null);
protected readonly isFormValid = computed(() => this.validateForm());// Shared SCSS modules for consistency
@use '../shared/form-styles';
.form-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
transition: transform 0.3s ease;
&:hover {
transform: translateY(-4px);
}
}The project includes automated deployment to GitHub Pages via GitHub Actions:
- Push to main branch triggers deployment
- Build process optimizes for production
- Deploy to GitHub Pages automatically
- Live site available at
https://tmac12.github.io/angular-forms/
# Build for production
npm run build:gh-pages
# Deploy to your hosting provider
# Files will be in dist/angular-forms/browser/- 🔄 Reactive Forms with Signals
- ⚡ Reactive Forms Classic
- 📝 Template-Driven Forms
- 🔀 Hybrid Template + Signals
Contributions are welcome! Please feel free to submit a Pull Request.
- Follow Angular style guide and best practices
- Write tests for new features
- Update documentation for significant changes
- Use conventional commits for commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
- Angular Team - For the amazing framework and new Signals API
- Community Contributors - For feedback and suggestions
- Claude Code - AI assistant that helped build this showcase
Built with ❤️ using Angular 20 and modern web technologies