Skip to content
Submitted about 1 month ago

Age Calculator App Angular

angular, typescript
LVL 1
@priscyladepaula
A solution to the Age calculator app challenge

Solution retrospective


What are you most proud of, and what would you do differently next time?

I am most proud of leveraging modern Angular features to build this app, specifically using Angular Signals for reactive state management and the new control flow syntax (@if) instead of the legacy *ngIf directive. This approach keeps the template cleaner and performance optimized. Next time, I would like to abstract the input value extraction to avoid using the $any($event.target).value casting, making the template 100% type-safe.

What challenges did you encounter, and how did you overcome them?

The biggest challenge was implementing a precise calendar validation algorithm (e.g., catching errors like April 31st) and handling complex future date validations seamlessly across all fields. I overcame this by writing a cascading validation system in TypeScript. It intelligently tracks whether a date is in the future based on the current year, and dynamically paints the exact input field (or all three fields combined if the year itself is future) using conditional signal-based state classes.

What specific areas of your project would you like help with?

I noticed some community feedback suggesting I switch back to *ngIf. However, I am intentionally using Angular's modern syntax (@if) to stay up-to-date with the framework's latest standards.

That being said, I would love feedback on:

  1. Signal Optimization: Is there a cleaner way to handle the input data-binding without resorting to (input)="day.set($any($event.target).value)" while still avoiding the heavy FormsModule?

  2. Animations: If anyone has experience animating numbers (0 to the target age) using the native @angular/animations or Web Animations API alongside Signals, I'd appreciate some tips or examples!

Code
Loading...

Please log in to post a comment

Log in

Community feedback

No feedback yet. Be the first to give feedback on Priscyla de Paula’s solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord