Skip to content

Commit 79a99e9

Browse files
chalinfiliph
authored andcommitted
[ng] template-syntax: use ngSwitchWhen (#328)
TS updated its syntax to `ngSwitchCase` and I failed to notice the change in the prose. AngularDart is still using `ngSwitchWhen` — this PR reverts the change in the prose. Fixes #288
1 parent f0a4317 commit 79a99e9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/angular/guide/template-syntax.jade

+5-5
Original file line numberDiff line numberDiff line change
@@ -1151,14 +1151,14 @@ figure.image-display
11511151
:marked
11521152
Three collaborating directives are at work here:
11531153
1. `ngSwitch`: bound to an expression that returns the switch value
1154-
1. `ngSwitchCase`: bound to an expression returning a match value
1154+
1. `ngSwitchWhen`: bound to an expression returning a match value
11551155
1. `ngSwitchDefault`: a marker attribute on the default element
11561156

11571157
.alert.is-critical
11581158
:marked
11591159
**Do *not*** put the asterisk (`*`) in front of `ngSwitch`. Use the property binding instead.
11601160

1161-
**Do** put the asterisk (`*`) in front of `ngSwitchCase` and `ngSwitchDefault`.
1161+
**Do** put the asterisk (`*`) in front of `ngSwitchWhen` and `ngSwitchDefault`.
11621162
For more information, see [\* and <template>](#star-template).
11631163

11641164
<a id="ngFor"></a>
@@ -1293,16 +1293,16 @@ figure.image-display
12931293
:marked
12941294
### Expanding `*ngSwitch`
12951295
A similar transformation applies to `*ngSwitch`. We can unfold the syntax ourselves.
1296-
Here's an example, first with `*ngSwitchCase` and `*ngSwitchDefault` and then again with `<template>` tags:
1296+
Here's an example, first with `*ngSwitchWhen` and `*ngSwitchDefault` and then again with `<template>` tags:
12971297
+makeExample('template-syntax/ts/app/app.component.html', 'NgSwitch-expanded')(format=".")
12981298
:marked
1299-
The `*ngSwitchCase` and `*ngSwitchDefault` expand in exactly the same manner as `*ngIf`,
1299+
The `*ngSwitchWhen` and `*ngSwitchDefault` expand in exactly the same manner as `*ngIf`,
13001300
wrapping their former elements in `<template>` tags.
13011301

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

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

0 commit comments

Comments
 (0)