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
feat: add bracket access to safe navigation operator #17181
Comments
Any updates? |
This syntax is too ambiguous, and already got rejected in optional chaining proposal. The final syntax should be Writing different syntax in logic code and template code may not be a good idea. |
Any updates on this? Thank you |
Not only for arrays, but also for objects this would be useful.
|
@sheikalthaf In JavaScript the syntax has been settled as |
@trotyl I guess we mostly interested in being able to navigation safely with arrays\objects. I believe very little people her are concerned in it being implemented via either |
Any updates or workarounds on this? |
Any possibility of this feature to be available in ivy? |
Any news on this feature? |
So, this is supported in TS 3.7 but not supported in expressions used in Angular templates: https://ng-run.com/edit/sqFt4zLEyZ9oOMDtmOxp |
For the record, we are tracking all issues related to |
Arrays/Indexes are safely navigated in templates but not in the way one would expect: However, it is not possible to safely navigate only one level: In TypeScript: |
I'm going to close it as a duplicate of #34385 - I think that the good, longer-term strategy is to align Angular expression syntax with what is cooking on the ES side: https://github.com/tc39/proposal-optional-chaining - we don't want to maintain same syntax with the different semantics on the Angular side. |
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 ... (check one with "x")
The safe navigation operator
?.
is great, but it would be even better if it also supported bracket notation,foo?[bar]
. This was first mentioned here, but didn't get any traction#791 (comment)
The text was updated successfully, but these errors were encountered: