-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Feature: extend template microsyntax to allow references #14877
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
Comments
what is |
Just some random name directive may have as |
I'm not following :) |
I'm not trying accomplish anything in particular. I wan't to introduce new syntax. <div *structuralDirective="value"></div> is equivalent of this: <template [structuralDirective]="value"><div></div></template> Currently it's not possible to get reference to structural directive using template microsyntax: <div *structuralDirective="value" #ref="structuralDirective"></div> will be translated to: <template [structuralDirective]="value"><div #ref="structuralDirective"></div></template> That's no good, because I was to reference directive on template element. So I proposed new sytanx: <div *structuralDirective="value; #ref=structuralDirective"></div> Which will work like this: <template [structuralDirective]="value" #ref="structuralDirective"><div></div></template> |
why? you can expose public properties via context object |
But they could be accessed only inside the template. As far i know, You cannot access it outside template, like this: <div *structuralDirective="let ref"></div>
<div>{{ref}}</div> |
Ok, but there's already an issue about that #12121 :
|
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. |
Closing due to insufficient votes. |
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")
Current behavior
Currently, it is not possible using template microsyntax to create reference on template element.
Expected behavior
Template microsyntax should be extended to allow references.
Proposed syntax:
should be equivalent of:
Minimal reproduction of the problem with instructions
N/A
What is the motivation / use case for changing the behavior?
It will enhance the means of interaction between components and directives.
For example, with the new feature, new (cleaner IMHO) if-else syntax could be possible:
And yes, I know 4.0.0 will introduce if-else, but that's not the point.
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: