Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 58d20e5

Browse files
filipesilvanaomiblack
authored andcommitted
chore: update ngSwitchWhen to ngSwitchCase
See angular/angular@e1fcab7
1 parent c467d56 commit 58d20e5

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

public/docs/_examples/cb-a1-a2-quick-reference/ts/app/movie-list.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ <h2>Movie List</h2>
1010
<!-- #docregion ngSwitch-->
1111
<span [ngSwitch]="favoriteHero &&
1212
checkMovieHero(favoriteHero)">
13-
<p *ngSwitchWhen="true">
13+
<p *ngSwitchCase="true">
1414
Excellent choice!
1515
</p>
16-
<p *ngSwitchWhen="false">
16+
<p *ngSwitchCase="false">
1717
No movie, sorry!
1818
</p>
1919
<p *ngSwitchDefault>

public/docs/_examples/cb-dynamic-form-deprecated/ts/app/dynamic-form-question.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
<div [ngSwitch]="question.controlType">
66

7-
<input *ngSwitchWhen="'textbox'" [ngControl]="question.key"
7+
<input *ngSwitchCase="'textbox'" [ngControl]="question.key"
88
[id]="question.key" [type]="question.type">
99

10-
<select [id]="question.key" *ngSwitchWhen="'dropdown'" [ngControl]="question.key">
10+
<select [id]="question.key" *ngSwitchCase="'dropdown'" [ngControl]="question.key">
1111
<option *ngFor="let opt of question.options" [value]="opt.key">{{opt.value}}</option>
1212
</select>
1313

public/docs/_examples/structural-directives/ts/app/structural-directives.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ <h1>Structural Directives</h1>
99
<!-- #enddocregion asterisk -->
1010
<!-- #docregion ngSwitch -->
1111
<div [ngSwitch]="status">
12-
<template [ngSwitchWhen]="'in-mission'">In Mission</template>
13-
<template [ngSwitchWhen]="'ready'">Ready</template>
12+
<template [ngSwitchCase]="'in-mission'">In Mission</template>
13+
<template [ngSwitchCase]="'ready'">Ready</template>
1414
<template ngSwitchDefault>Unknown</template>
1515
</div>
1616
<!-- #enddocregion ngSwitch -->

public/docs/_examples/template-syntax/ts/app/app.component.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -498,18 +498,18 @@ <h3>Use setStyles() - CSS property names</h3>
498498

499499
<!-- with *NgSwitch -->
500500
<!-- #docregion NgSwitch -->
501-
<span *ngSwitchWhen="'Eenie'">Eenie</span>
502-
<span *ngSwitchWhen="'Meanie'">Meanie</span>
503-
<span *ngSwitchWhen="'Miney'">Miney</span>
504-
<span *ngSwitchWhen="'Moe'">Moe</span>
501+
<span *ngSwitchCase="'Eenie'">Eenie</span>
502+
<span *ngSwitchCase="'Meanie'">Meanie</span>
503+
<span *ngSwitchCase="'Miney'">Miney</span>
504+
<span *ngSwitchCase="'Moe'">Moe</span>
505505
<span *ngSwitchDefault>other</span>
506506
<!-- #enddocregion NgSwitch -->
507507

508508
<!-- with <template> -->
509-
<template [ngSwitchWhen]="'Eenie'"><span>Eenie</span></template>
510-
<template [ngSwitchWhen]="'Meanie'"><span>Meanie</span></template>
511-
<template [ngSwitchWhen]="'Miney'"><span>Miney</span></template>
512-
<template [ngSwitchWhen]="'Moe'"><span>Moe</span></template>
509+
<template [ngSwitchCase]="'Eenie'"><span>Eenie</span></template>
510+
<template [ngSwitchCase]="'Meanie'"><span>Meanie</span></template>
511+
<template [ngSwitchCase]="'Miney'"><span>Miney</span></template>
512+
<template [ngSwitchCase]="'Moe'"><span>Moe</span></template>
513513
<template ngSwitchDefault><span>other</span></template>
514514

515515
<!-- #docregion NgSwitch -->

public/docs/ts/latest/cookbook/a1-a2-quick-reference.jade

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,15 @@ table(width="100%")
444444
+makeExample('cb-a1-a2-quick-reference/ts/app/movie-list.component.html', 'ngSwitch')(format="." )
445445
:marked
446446
In Angular&nbsp;2, the `ngSwitch` directive works similarly.
447-
It displays an element whose `*ngSwitchWhen` matches the current `ngSwitch` expression value.
447+
It displays an element whose `*ngSwitchCase` matches the current `ngSwitch` expression value.
448448

449449
In this example, if `favoriteHero` is not set, the `ngSwitch` value is `null`
450450
and we see the `*ngSwitchDefault` paragraph, "Please enter ...".
451451
If the `favoriteHero` is set, it checks the movie hero by calling a component method.
452452
If that method returns `true`, we see "Excellent choice!".
453453
If that methods returns `false`, we see "No movie, sorry!".
454454

455-
The (*) before `ngSwitchWhen` and `ngSwitchDefault` is required in this example.
455+
The (*) before `ngSwitchCase` and `ngSwitchDefault` is required in this example.
456456

457457
For more information on the ngSwitch directive see [Template Syntax](../guide/template-syntax.html#ngSwitch).
458458
:marked

public/docs/ts/latest/guide/template-syntax.jade

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,14 +1053,14 @@ block dart-no-truthy-falsey
10531053
:marked
10541054
Three collaborating directives are at work here:
10551055
1. `ngSwitch`: bound to an expression that returns the switch value
1056-
1. `ngSwitchWhen`: bound to an expression returning a match value
1056+
1. `ngSwitchCase`: bound to an expression returning a match value
10571057
1. `ngSwitchDefault`: a marker attribute on the default element
10581058

10591059
.alert.is-critical
10601060
:marked
10611061
**Do *not*** put the asterisk (`*`) in front of `ngSwitch`. Use the property binding instead.
10621062

1063-
**Do** put the asterisk (`*`) in front of `ngSwitchWhen` and `ngSwitchDefault`.
1063+
**Do** put the asterisk (`*`) in front of `ngSwitchCase` and `ngSwitchDefault`.
10641064
For more information, see [\* and &lt;template>](#star-template).
10651065

10661066
<a id="ngFor"></a>
@@ -1199,16 +1199,16 @@ block remember-the-brackets
11991199
:marked
12001200
### Expanding `*ngSwitch`
12011201
A similar transformation applies to `*ngSwitch`. We can de-sugar the syntax ourselves.
1202-
Here's an example, first with `*ngSwitchWhen` and `*ngSwitchDefault` and then again with `<template>` tags:
1202+
Here's an example, first with `*ngSwitchCase` and `*ngSwitchDefault` and then again with `<template>` tags:
12031203
+makeExample('template-syntax/ts/app/app.component.html', 'NgSwitch-expanded')(format=".")
12041204
:marked
1205-
The `*ngSwitchWhen` and `*ngSwitchDefault` expand in exactly the same manner as `*ngIf`,
1205+
The `*ngSwitchCase` and `*ngSwitchDefault` expand in exactly the same manner as `*ngIf`,
12061206
wrapping their former elements in `<template>` tags.
12071207

12081208
Now we can see why the `ngSwitch` itself is not prefixed with an asterisk (*).
12091209
It does not define content. It's job is to control a collection of templates.
12101210

1211-
In this case, it governs two sets of `NgSwitchWhen` and `NgSwitchDefault` directives.
1211+
In this case, it governs two sets of `ngSwitchCase` and `NgSwitchDefault` directives.
12121212
We should expect it to display the values of the selected template twice,
12131213
once for the (*) prefixed version and once for the expanded template version.
12141214
That's exactly what we see in this example:

0 commit comments

Comments
 (0)