Creating a service for logging activities

The goal of this chapter is to provide a way to keep track of all user activities within a task management application. For that purpose, we'll need a system that will allow us to log activities within components and access previously logged activities.

Within this chapter, we'll only track activities on projects. However, the activity tracker can be used in any feature within our application. We're going to use TypeScript discriminated unions to describe our activities. Let's jump right into it and start by creating the model used within our new activities feature.

Let's open our model file, located in src/app/model.ts, and add the following changes:

…export type ActivityAlignment = 'left' | 'right'; ...

Get Mastering Angular Components now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.