-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Template Local Variables #15280
Copy link
Copy link
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimefeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq3: highhotlist: google
Milestone
Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimefeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq3: highhotlist: google
[X] feature request
Current behavior
The new syntax is a great improvement!
... And was discussed at length in #15020.
Expected behavior
The ability to capture the async pipe output and make it available as a template variable, is much appreciated and very useful. Unfortunately, this capability is currently bound closely to
*ngIf; it is only available is a feature of*ngIf. (I am aware that there is something similar for*ngFor, unrelated to this feature request).Here's what I request: that this capability be yanked apart from the conditional (
*ngIf), and made available elsewhere.I don't know what syntax would make the most sense. Perhaps:
Or alternatively; it would be excellent to have a syntax to directly use any observable anywhere in a template, with the reactivity handled by Angular, and without worrying about potentially multiple async pipe instances needlessly subscribing many times. For example, imagine the following syntax:
What is the motivation / use case for changing the behavior?
I have a use case in front of me, the details which don't matter, where:
*ngIfs which exists solely for the purpose of giving access to this ability to capture the async values to template variables.