You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(compiler): Support "in" operator in Angular templates #38560
I'd like to have your opinions about supporting "in" operator in html templates. Let's say I have an object of a union type A | B. I'd like to use the 'in' operator to differentiate type.
Something like:
export interface A {
a: number
}
export interface B {
b: string
}
export type MyUnionType = A | B;
item: MyUnionType = {
a: 1
}
<div *ngIf="'a' in item">
I'm expecting item is no longer of type A | B, but only A
{{item.a}}
</div>
Reacted by Aleksei Lebedev, Dexter Tad-y, Samuel Fernández, Rafael Mestre, Ertunga Bezirgan, Indraraj, Sheik Althaf, Vsevolod Vinogradov, Aleksey Zheleznyakov, Denis Bendrikov and 4 more
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.
changed the title [-]feat(compikler): Support "in" operator in Angular templates[/-][+]feat(compiler): Support "in" operator in Angular templates[/+]on Sep 17, 2021
Activity
[-]Support "in" operator in Angular teplate[/-][+]Support "in" operator in Angular templates[/+]angular-robot commentedon Jun 4, 2021
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.
angular-robot commentedon Jun 24, 2021
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.
alxhub commentedon Jul 8, 2021
In this spirit of aligning Angular expression syntax with JS expression syntax, I'm moving this into our triage process for further discussion.
[-]Support "in" operator in Angular templates[/-][+]feat(compikler): Support "in" operator in Angular templates[/+][-]feat(compikler): Support "in" operator in Angular templates[/-][+]feat(compiler): Support "in" operator in Angular templates[/+]petebacondarwin commentedon Oct 15, 2021
This is being tracked in the aggregate issue of #43485 for which we need to create a project proposal.
alxhub commentedon Feb 1, 2022
^ closing as we're discussing these improvements to template expression syntax holistically, along the theme of unifying Angular syntax with JS.
angular-automatic-lock-bot commentedon Mar 4, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.