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

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

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