Angular · Junior · Question 24 of 75
How do you create a custom pipe?
- ✓Correct answer: A class with
@Pipe({ name: 'truncate' })that implementstransform(value, ...args) - 2A function exported from any file and called with
|automatically - 3A component with the
pipe: trueoption
Explanation
Add the pipe class to the imports of the component that uses it. Pipes are pure by default: transform runs again only when the input value or arguments change by reference.