Integrating tags using a pipe

All of the concerns of our task service have now been taken care of, and it is already storing tags for available projects. We can now go ahead and integrate our service into the application.

Since our tags service turns text with simple hashtags into HTML with links, a pipe would be a perfect helper to integrate the functionality within our components.

Let's create a new pipe by using the Angular CLI tool:

ng generate pipe --spec false pipes/tags

Open up the generated file, located in src/app/pipes/tags.pipe.ts, and add the following code:

import {Pipe, PipeTransform} from '@angular/core';import {TagsService} from '../tags/tags.service';import {DomSanitizer} from '@angular/platform-browser';import {map} from ...

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.