CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/angular-best-practices

Angular patterns — standalone components, signals, inject(), reactive forms, HTTP interceptors, and new control flow

95

2.75x
Quality

94%

Does it follow best practices?

Impact

99%

2.75x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

Notification Bell

Build a notification bell component in Angular. The component should:

  1. Poll a REST API (GET /api/notifications/unread-count) every 30 seconds to get the number of unread notifications.
  2. Display a bell icon with a badge showing the unread count. Hide the badge when the count is zero.
  3. When clicked, open a dropdown that fetches the latest 10 notifications from GET /api/notifications?limit=10 and displays them as a list with title, message preview, and relative timestamp.
  4. Handle API errors gracefully -- show a "Could not load notifications" message instead of breaking.

API Response Shapes

// GET /api/notifications/unread-count
{ "data": { "count": 3 } }

// GET /api/notifications?limit=10
{
  "data": [
    {
      "id": "n1",
      "title": "New comment",
      "preview": "Alice replied to your post...",
      "createdAt": "2025-12-01T10:30:00Z",
      "read": false
    }
  ]
}

Output

Produce TypeScript files in a src/app/ directory:

  • src/app/notifications/notification.model.ts -- TypeScript type definitions
  • src/app/notifications/notification.service.ts -- service handling both API calls
  • src/app/notifications/notification-bell.component.ts -- the bell with badge and dropdown

Do not include test files or build configuration.

evals

tile.json