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

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

Merged
merged 1 commit into from Jun 10, 2016

Conversation

Projects
None yet
4 participants
@robwormald
Member

robwormald commented Jun 7, 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, though *ngSwitchWhen is still supported, temporarily

supersedes #7639

@googlebot googlebot added the cla: yes label Jun 7, 2016

@robwormald robwormald referenced this pull request Jun 7, 2016

Closed

refactor(common): change ngSwitchWhen to ngSwitchCase #7639

3 of 3 tasks complete
this._switch._onCaseValueChanged(this._value, value, this._view);
this._value = value;
}
set ngSwitchWhen(value: any) {

This comment has been minimized.

@vicb

vicb Jun 7, 2016

Contributor

console.log('deprecated').once()

@vicb

This comment has been minimized.

Contributor

vicb commented Jun 8, 2016

LGTM, you can merge if you get Travis green (7aa1790 should have solved the issue - not related to this PR)

@vicb vicb added the pr_state: LGTM label Jun 8, 2016

/** @internal */
_view: SwitchView;
//TODO: remove when fully deprecated
/** @internal */
_warned:boolean;

This comment has been minimized.

@vicb

vicb Jun 8, 2016

Contributor

could you make this global instead of instance based ?

This comment has been minimized.

@robwormald

robwormald Jun 10, 2016

Member

i figured instance based would make it easier to track down all of them in your codebase, with the tradeoff of being slightly more annoying.

}
this._activateViews(views);
this._switchValue = value;
}
/** @internal */
_onWhenValueChanged(oldWhen: any, newWhen: any, view: SwitchView): void {
_onCaseValueChanged(oldWhen: any, newWhen: any, view: SwitchView): void {

This comment has been minimized.

@MathewBerg

MathewBerg Jun 9, 2016

Should these be changed to oldCase/newCase from oldWhen/newWhen?

This comment has been minimized.

@vicb

vicb Jun 10, 2016

Contributor

oldWhen/newCase ?

This comment has been minimized.

@robwormald

robwormald Jun 10, 2016

Member

corrected 👍

@robwormald robwormald merged commit e1fcab7 into angular:master Jun 10, 2016

3 checks passed

ci/circleci Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@robwormald robwormald deleted the robwormald:ngswitch branch Jun 10, 2016

tycho01 added a commit to tycho01/angular that referenced this pull request Jun 10, 2016

tycho01 added a commit to tycho01/angular that referenced this pull request Jun 21, 2016

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