Pipes

The last two building blocks that I want to explain here are pipes and routes. pipes are wonderful. They allow us to create a specialized class that will take and transform any input into the desired output. In Angular, pipes follow the Unix pipes programming paradigm, where information can be passed from one process to another. What we can do with our Floyd triangle-based application creates a Pipe that will transform any given Floyd string to include the ASCII character for a paragraph (244, ¶) every time it encounters the newline sequences (such as \n\r):

import { Pipe, PipeTransform } from '@angular/core';  @Pipe({   name: 'paragraph' }) export class ParagraphPipe implements PipeTransform {   transform(value: string): string ...

Get Angular Design Patterns 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.