-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define function as pipe #49074
Comments
@alxhub I believe it could be done something different from what was purposed on those issues you mentioned. With the new function namePipe() {
const myService = inject(MyService);
return function transform(name: string) {
return myService.parseName(name);
}
}
...
// Then use it on your template
{{ name | name }} |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are relevant/related to the feature request?
core
Description
It would be nice to be able to define functions in my component at file as pipe instead of defining class for each pipe.
Sometimes the function is specific to a component and isn’t reusable, but we want it to have a pipe like behavior.
Proposed solution
Add pipe decorator to component’s function
Alternatives considered
Define many specific pipes
The text was updated successfully, but these errors were encountered: