-
Notifications
You must be signed in to change notification settings - Fork 16
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
pipes that call functions #1510
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1510 +/- ##
========================================
Coverage 43.86% 43.86%
========================================
Files 312 312
Lines 9378 9378
Branches 2245 2245
========================================
Hits 4114 4114
Misses 3433 3433
Partials 1831 1831 ☔ View full report in Codecov by Sentry. |
This pull request introduces 1 alert when merging 570d4f5 into fd0e07c - view on LGTM.com new alerts:
|
This pull request introduces 1 alert when merging a080006 into 59df8f0 - view on LGTM.com new alerts:
|
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Description
This draft PR explores a technique that harnesses Angular pipes and associated change detection infrastructure to efficiently call functions from our Angular templates.
This PR creates two pipes:
function
, andmethod
.The
function
pipe binds its first argument asthis
to its second argument, which is a function. The bound function is then called, with the first argument being the pipe input value, and the remaining pipe arguments being the additional function arguments. For example, the Angular expression{{ org | function: this:brace }}
maps to the function callthis.brace(org)
The
method
pipe binds the pipe input value asthis
to its first argument, which is a function. The bound function is then called, with the remaining pipe arguments. For example, the Angular expression{{ org | method: org.getLink }}
maps to the method callorg.getLink()
. A more advanced implementation would also support a string as the first argument, which would name a field of the piped value, and geteval
-ed to a function value at run time.All the example invocations in the PR don't do anything useful at present, and two are broken.
This is a very rough proof-of-concept, not production ready, and should not be merged.