diff options
| author | Pete Bacon Darwin | 2013-12-12 11:42:49 +0000 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-12-12 11:42:49 +0000 | 
| commit | 9396d55414ef41ec3a109eefcf6c65dc00b446c4 (patch) | |
| tree | 154bfa643196fccebf56860b263cb73023f51de6 | |
| parent | 82e97cf53e93b2e0032e9220022be1245552fd10 (diff) | |
| download | angular.js-9396d55414ef41ec3a109eefcf6c65dc00b446c4.tar.bz2 | |
docs(ngSwitch): clarify that ngSwitch matches against string literals
Closes #5285
| -rw-r--r-- | src/ng/directive/ngSwitch.js | 18 | 
1 files changed, 13 insertions, 5 deletions
| diff --git a/src/ng/directive/ngSwitch.js b/src/ng/directive/ngSwitch.js index d4387ae2..99832fc8 100644 --- a/src/ng/directive/ngSwitch.js +++ b/src/ng/directive/ngSwitch.js @@ -6,19 +6,26 @@   * @restrict EA   *   * @description - * The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression. - * Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location + * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression. + * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location   * as specified in the template.   *   * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it - * from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element + * from the template cache), `ngSwitch` simply choses one of the nested elements and makes it visible based on which element   * matches the value obtained from the evaluated expression. In other words, you define a container element - * (where you place the directive), place an expression on the **on="..." attribute** - * (or the **ng-switch="..." attribute**), define any inner elements inside of the directive and place + * (where you place the directive), place an expression on the **`on="..."` attribute** + * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place   * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on   * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default   * attribute is displayed.   * + * <div class="alert alert-info"> + * Be aware that the attribute values to match against cannot be expressions. They are interpreted + * as literal string values to match against. + * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the + * value of the expression `$scope.someVal`. + * </div> +   * @animations   * enter - happens after the ngSwitch contents change and the matched child element is placed inside the container   * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM @@ -30,6 +37,7 @@   *   <ANY ng-switch-default>...</ANY>   * </ANY>   * + *   * @scope   * @priority 800   * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>. | 
