O'Reilly logo

Mastering Angular Components by Gion Kunz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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'; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required