-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Description
I'm submitting a ...
[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current way of using laborious variable calls
Consider this code template:
<td *ngFor="let attribute of attributes">
<p>{{ product.productData.get(attribute.id).value }}</p>
<p>{{ product.productData.get(attribute.id).date }}</p>
<p>{{ product.productData.get(attribute.id).something }}</p>
</td>
That's an awful lot of repeated typing for repeated logic. It doesn't feel to me like it would make sense to create a sub-component for these two lines. So I want to suggest the introduction of local variable assignment. The above could then look like the following:
Suggested syntax
<td *ngFor="let attribute of attributes" #values="product.productData.get(attribute.id)">
<p>{{ values.value }}</p>
<p>{{ values.date }}</p>
<p>{{ values.something }}</p>
</td>
I deliberately used the #x="y"
-syntax, even though it is currently not meant to be used like that (and will throw an error).
-
Angular version: 2.4.9
-
Browser: all
-
Language: all
aristotll, PowerSupply, CarlosHAraujo, NotIntMan and dverbovyi
Metadata
Metadata
Assignees
Labels
No labels