8000 feat(compiler): Support "in" operator in Angular templates · Issue #38560 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

feat(compiler): Support "in" operator in Angular templates #38560

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

Closed
manueledones opened this issue Aug 24, 2020 · 6 comments
Closed

feat(compiler): Support "in" operator in Angular templates #38560

manueledones opened this issue Aug 24, 2020 · 6 comments
Assignees
Labels
area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime core: binding & interpolation Issue related to property/attribute binding or text interpolation feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature: votes required Feature request which is currently still in the voting phase feature Issue that requests a new feature
Milestone

Comments

@manueledones
Copy link
Contributor
manueledones commented Aug 24, 2020

🚀 feature request

Description

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>

Here is a stackblitz

@manueledones manueledones changed the title Support "in" operator in Angular teplate Support "in" operator in Angular templates Aug 24, 2020
@sonukapoor sonukapoor added feature Issue that requests a new feature core: basic template syntax labels Aug 24, 2020
@pkozlowski-opensource pkozlowski-opensource added core: binding & interpolation Issue related to property/attribute binding or text interpolation and removed core: basic template syntax labels Aug 24, 2020
@AndrewKushnir AndrewKushnir added area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime labels Aug 24, 2020
@ngbot ngbot bot modified the milestone: Backlog Aug 24, 2020
@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Jun 4, 2021
@angular-robot
Copy link
Contributor
angular-robot bot commented 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
Copy link
Contributor
angular-robot bot commented 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.

@angular-robot angular-robot bot added the feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors label Jun 24, 2021
@alxhub
Copy link
Member
alxhub commented 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.

@petebacondarwin petebacondarwin changed the title Support "in" operator in Angular templates feat(compikler): Support "in" operator in Angular templates Sep 17, 2021
@petebacondarwin petebacondarwin changed the title feat(compikler): Support "in" operator in Angular templates feat(compiler): Support "in" operator in Angular templates Sep 17, 2021
@petebacondarwin
Copy link
Contributor

This is being tracked in the aggregate issue of #43485 for which we need to create a project proposal.

@alxhub
Copy link
Member
alxhub commented Feb 1, 2022

^ closing as we're discussing these improvements to template expression syntax holistically, along the theme of unifying Angular syntax with JS.

@alxhub alxhub closed this as completed Feb 1, 2022
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: compiler Issues related to `ngc`, Angular's template compiler area: core Issues related to the framework runtime core: binding & interpolation Issue related to property/attribute binding or text interpolation feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature: votes required Feature request which is currently still in the voting phase feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

6 participants
0