What is pipe() function in Angular

前端 未结 5 1592
时光取名叫无心
时光取名叫无心 2020-12-12 13:10

Pipes are filters for transforming data (formats) in the template.

I came across the pipe() function as below. What does this pipe() functi

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-12 13:53

    Don't get confused with the concepts of Angular and RxJS

    We have pipes concept in Angular and pipe() function in RxJS.

    1) Pipes in Angular: A pipe takes in data as input and transforms it to the desired output
    https://angular.io/guide/pipes

    2) pipe() function in RxJS: You can use pipes to link operators together. Pipes let you combine multiple functions into a single function.

    The pipe() function takes as its arguments the functions you want to combine, and returns a new function that, when executed, runs the composed functions in sequence.
    https://angular.io/guide/rx-library (search for pipes in this URL, you can find the same)

    So according to your question, you are referring pipe() function in RxJS

提交回复
热议问题