|
6 | 6 | * @restrict EA
|
7 | 7 | *
|
8 | 8 | * @description
|
9 |
| - * The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression. |
10 |
| - * Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location |
| 9 | + * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression. |
| 10 | + * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location |
11 | 11 | * as specified in the template.
|
12 | 12 | *
|
13 | 13 | * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
|
14 |
| - * from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element |
| 14 | + * from the template cache), `ngSwitch` simply choses one of the nested elements and makes it visible based on which element |
15 | 15 | * matches the value obtained from the evaluated expression. In other words, you define a container element
|
16 |
| - * (where you place the directive), place an expression on the **on="..." attribute** |
17 |
| - * (or the **ng-switch="..." attribute**), define any inner elements inside of the directive and place |
| 16 | + * (where you place the directive), place an expression on the **`on="..."` attribute** |
| 17 | + * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place |
18 | 18 | * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
|
19 | 19 | * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
|
20 | 20 | * attribute is displayed.
|
21 | 21 | *
|
| 22 | + * <div class="alert alert-info"> |
| 23 | + * Be aware that the attribute values to match against cannot be expressions. They are interpreted |
| 24 | + * as literal string values to match against. |
| 25 | + * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the |
| 26 | + * value of the expression `$scope.someVal`. |
| 27 | + * </div> |
| 28 | +
|
22 | 29 | * @animations
|
23 | 30 | * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container
|
24 | 31 | * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM
|
|
30 | 37 | * <ANY ng-switch-default>...</ANY>
|
31 | 38 | * </ANY>
|
32 | 39 | *
|
| 40 | + * |
33 | 41 | * @scope
|
34 | 42 | * @priority 800
|
35 | 43 | * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>.
|
|
0 commit comments