Premium

Like Button (Facebook-style Toggle)

By FrontendAtlas Editorial · Updated Jan 30, 2026

Challenge summary

Create a Like button with toggle state and a counter in Angular. Clicking should increment on like, decrement on unlike, and never allow the count to drop below zero.

What you'll practice

  • Use a standalone Angular component as the root component.
  • Render a Like button with an icon, label, and a like count.
  • Update the button visual style based on liked state.
  • Second click: becomes unliked, count decreases by 1, button returns to normal.
  • The template should reflect state immediately and apply an active class when liked.

What Premium unlocks

Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.

Free related practice

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.