>

CODEMASTERYLAB

IDE PLATFORM
CoursesCommunity BlogsKnowledge GraphQuizzesInterview Prep

Sign in to track progress & earn XP

Sign In Create Account
>
Code Mastery Lab

Code Mastery Lab

Sign In

Pipes — Transforming Data in Templates Without Polluting Components

Question 1 / 1

0:00
Core
Medium

A FilterActivePipe is a pure pipe that filters an array of users to only active ones. Your component calls this.users.push(newActiveUser) after an API response. The template using {{ users | filterActive }} does not show the new user. What is the cause and fix?

typescript @Pipe({ name: 'filterActive' }) export class FilterActivePipe implements PipeTransform { transform(users: User[]): User[] { return users.filter(u => u.isActive); } }

// component this.users.push(newActiveUser); // new user added