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

refactor(common): change ngSwitchWhen to ngSwitchCase #7639

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
8 participants
@robwormald
Member

robwormald commented Mar 17, 2016

Changes NgSwitchWhen directive to be NgSwitchCase

  • What is the current behavior? (You can also link to an open issue here)

Closes #7571

Current syntax:

<div [ngSwitch]="value">
  <p *ngSwitchWhen="'init'">increment to start</p>
  <p *ngSwitchWhen="0">0, increment again</p>
  <p *ngSwitchWhen="1">1, increment again</p>
  <p *ngSwitchWhen="2">2, stop incrementing</p>
  <p *ngSwitchDefault>&gt; 2, STOP!</p>
</div>
  • What is the new behavior (if this is a feature change)?
<div [ngSwitch]="value">
  <p *ngSwitchCase="'init'">increment to start</p>
  <p *ngSwitchCase="0">0, increment again</p>
  <p *ngSwitchCase="1">1, increment again</p>
  <p *ngSwitchCase="2">2, stop incrementing</p>
  <p *ngSwitchDefault>&gt; 2, STOP!</p>
</div>
  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Users should use *ngSwitchCase instead of *ngSwitchWhen in templates

@googlebot googlebot added the cla: yes label Mar 17, 2016

<template ngSwitchDefault>...</template>
</div>`|`[ngSwitch]`|`[ngSwitchWhen]`|`ngSwitchWhen`|`ngSwitchDefault`
</div>`|`[ngSwitch]`|`[ngSwitcCase]`|`ngSwitchCase`|`ngSwitchDefault`

This comment has been minimized.

@DevVersion

DevVersion Mar 17, 2016

Member

I think, you got the spelling wrong here. ngSwitcCase -> ngSwitchCase

This comment has been minimized.

@robwormald

robwormald Mar 17, 2016

Member

Oops, good catch

@deeleman

This comment has been minimized.

deeleman commented Mar 27, 2016

Could you guys provide any hint of when will this change get merged into the master branch? Thanks in advance. :)

@alxhub

This comment has been minimized.

Contributor

alxhub commented Apr 11, 2016

This is a huge breaking change, and I don't see any reason why it needs to be a big bang. Can we do this as a deprecation change instead?

Step 1: Add [ngSwitchCase] syntax as an alias for [ngSwitchWhen] and add a deprecation annotation to [ngSwitchWhen] syntax.
Step 2: Users migrate from [ngSwitchWhen] to [ngSwitchCase].
Step 3: Remove old [ngSwitchWhen] syntax entirely.

@mhevery

This comment has been minimized.

Member

mhevery commented May 23, 2016

@robwormald can you make it so that it works in both modes? I think it just needs to have a selector: '[ngSwitchWhen],[ngSwitchCase]' and have both inputs.

@mhevery

This comment has been minimized.

Member

mhevery commented Jun 7, 2016

@robwormald any update on progress?

@robwormald robwormald referenced this pull request Jun 7, 2016

Merged

fix(ngSwitch): use switchCase instead of switchWhen #9076

3 of 3 tasks complete
@robwormald

This comment has been minimized.

Member

robwormald commented Jun 7, 2016

closing in favor of #9076

@robwormald robwormald closed this Jun 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment