-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Async select field (new syntax) #18919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers an 10000 d 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
Comments
That aside I don't like the syntax since it blurs the lines between normal objects and Observables where this should be distinct and not ambiguous |
I can see your point about it being ambiguous though, you're right it blurs the meaning of what the object is. Would it help if for non-observable objects the property would just be selected as a regular field ( Another approach is simply using a pipe which is async and selects a field. Could be properly typed with typescripts |
This sounds very similar to the issue #15280 where there is a lot of discussion about pulling out certain property value from an observable. At the end of a day we might not implement the syntax proposed here but the use-case is real. |
Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends. Find more details about Angular's feature request process in our documentation. |
Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage. We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package. You can find more details about the feature request process in our documentation. |
This is being tracked in the aggregate issue of #43485 for which we need to create a project proposal. |
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. |
I'm submitting a...
Current behavior
It's currently not possible to easily select a property of an async object in a template without either
ngIf
or usingas
async
pipe and existential operator, ie(thing$ | async)?.prop
Expected behavior / motivation
It would be very convenient with a new syntax to select properties directly off an observable. In the vein of typescript's existential operator, eg:
Instead of
It would be nice with
Meaning
obj|.prop
is practically syntax sugar for(obj | async)?.prop
.The text was updated successfully, but these errors were encountered: