6

What Is Angular Pure Pipe?

What Is Pure Pipe?
Angular executes a pure pipe only when it detects a pure change to the input value. A pure change can be primitive or non-primitive.

Primitive data are only single values, they have not special capabilities and the non-primitive data types are used to store the group of values.

@Pipe({
  name: 'currency'
})

OR
@Pipe({
  name: 'currency',
  pure: true
})

And another example for a pure pipe –
import { PipePipeTransform } from '@angular/core';

@Pipe({
  name: 'currency'
})
export class CurrencyPipe implements PipeTransform {

  transform(valueanyargs?: any): any {
    if (!value) {
      return '1.00';
    }

    return value;
  }
}

ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

What Is Angular Pure Pipe? What Is Angular Pure Pipe? Reviewed by Anil Singh on 2:56 AM Rating: (5)
www.code-sample.com/. Powered by Blogger.
^