Skip to content
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(compiler): Support "in" operator in Angular templates #38560

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
comp: compiler comp: core Runtime issues core: binding & interpolation Issue related to property/attribute binding or text interpolation feature Issue that requests a new feature insufficient votes votes required
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
@ngbot ngbot bot modified the milestone: Backlog Aug 24, 2020
@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.

@alxhub
Copy link
Contributor

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.

@alxhub alxhub added this to Inbox in Feature Requests via automation Jul 8, 2021
@alxhub alxhub moved this from Inbox to Needs Discussion in Feature Requests Jul 8, 2021
@alxhub alxhub moved this from Needs Discussion to Backlog in Feature Requests Jul 15, 2021
@alxhub alxhub moved this from Backlog to Close with Followup in Feature Requests Jul 16, 2021
@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
Member

petebacondarwin commented Oct 15, 2021

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

@alxhub
Copy link
Contributor

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
Feature Requests automation moved this from Close with Followup to Closed Feb 1, 2022
@angular-automatic-lock-bot
Copy link

angular-automatic-lock-bot bot commented 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.

@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
comp: compiler comp: core Runtime issues core: binding & interpolation Issue related to property/attribute binding or text interpolation feature Issue that requests a new feature insufficient votes votes required
Projects
Development

No branches or pull requests

6 participants