@@ -24,39 +24,39 @@ class SwitchView {
2424}
2525
2626/**
27- * The `Switch ` directive is used to conditionally swap DOM structure on your template based on a
27+ * The `NgSwitch ` directive is used to conditionally swap DOM structure on your template based on a
2828 * scope expression.
29- * Elements within `Switch ` but without `SwitchWhen ` or `SwitchDefault ` directives will be
29+ * Elements within `NgSwitch ` but without `NgSwitchWhen ` or `NgSwitchDefault ` directives will be
3030 * preserved at the location as specified in the template.
3131 *
32- * `Switch ` simply chooses nested elements and makes them visible based on which element matches
32+ * `NgSwitch ` simply chooses nested elements and makes them visible based on which element matches
3333 * the value obtained from the evaluated expression. In other words, you define a container element
34- * (where you place the directive), place an expression on the **`[switch]="..."` attribute**),
35- * define any inner elements inside of the directive and place a `[switch-when]` attribute per
34+ * (where you place the directive), place an expression on the **`[ng- switch]="..."` attribute**),
35+ * define any inner elements inside of the directive and place a `[ng- switch-when]` attribute per
3636 * element.
37- * The when attribute is used to inform Switch which element to display when the expression is
37+ * The when attribute is used to inform NgSwitch which element to display when the expression is
3838 * evaluated. If a matching expression is not found via a when attribute then an element with the
3939 * default attribute is displayed.
4040 *
4141 * # Example:
4242 *
4343 * ```
44- * <ANY [switch]="expression">
45- * <template [switch-when]="whenExpression1">...</template>
46- * <template [switch-when]="whenExpression1">...</template>
47- * <template [switch-default]>...</template>
44+ * <ANY [ng- switch]="expression">
45+ * <template [ng- switch-when]="whenExpression1">...</template>
46+ * <template [ng- switch-when]="whenExpression1">...</template>
47+ * <template [ng- switch-default]>...</template>
4848 * </ANY>
4949 * ```
5050 *
5151 * @exportedAs angular2/directives
5252 */
5353@Directive ( {
54- selector : '[switch]' ,
54+ selector : '[ng- switch]' ,
5555 properties : {
56- 'value ' : 'switch '
56+ 'ngSwitch ' : 'ngSwitch '
5757 }
5858} )
59- export class Switch {
59+ export class NgSwitch {
6060 _switchValue : any ;
6161 _useDefault : boolean ;
6262 _valueViews : Map ;
@@ -68,7 +68,7 @@ export class Switch {
6868 this . _useDefault = false ;
6969 }
7070
71- set value ( value ) {
71+ set ngSwitch ( value ) {
7272 // Empty the currently active ViewContainers
7373 this . _emptyAllActiveViews ( ) ;
7474
@@ -150,32 +150,32 @@ export class Switch {
150150/**
151151 * Defines a case statement as an expression.
152152 *
153- * If multiple `SwitchWhen ` match the `Switch ` value, all of them are displayed.
153+ * If multiple `NgSwitchWhen ` match the `NgSwitch ` value, all of them are displayed.
154154 *
155155 * Example:
156156 *
157157 * ```
158158 * // match against a context variable
159- * <template [switch-when]="contextVariable">...</template>
159+ * <template [ng- switch-when]="contextVariable">...</template>
160160 *
161161 * // match against a constant string
162- * <template [switch-when]="'stringValue'">...</template>
162+ * <template [ng- switch-when]="'stringValue'">...</template>
163163 * ```
164164 *
165165 * @exportedAs angular2/directives
166166 */
167167@Directive ( {
168- selector : '[switch-when]' ,
168+ selector : '[ng- switch-when]' ,
169169 properties : {
170- 'when ' : 'switch-when '
170+ 'ngSwitchWhen ' : 'ngSwitchWhen '
171171 }
172172} )
173- export class SwitchWhen {
173+ export class NgSwitchWhen {
174174 _value : any ;
175- _switch : Switch ;
175+ _switch : NgSwitch ;
176176 _view : SwitchView ;
177177
178- constructor ( viewContainer : ViewContainerRef , protoViewRef : ProtoViewRef , @Parent ( ) sswitch : Switch ) {
178+ constructor ( viewContainer : ViewContainerRef , protoViewRef : ProtoViewRef , @Parent ( ) sswitch : NgSwitch ) {
179179 // `_whenDefault` is used as a marker for a not yet initialized value
180180 this . _value = _whenDefault ;
181181 this . _switch = sswitch ;
@@ -186,7 +186,7 @@ export class SwitchWhen {
186186 this . _switch
187187 }
188188
189- set when ( value ) {
189+ set ngSwitchWhen ( value ) {
190190 this . _switch . _onWhenValueChanged ( this . _value , value , this . _view ) ;
191191 this . _value = value ;
192192 }
@@ -196,21 +196,21 @@ export class SwitchWhen {
196196/**
197197 * Defines a default case statement.
198198 *
199- * Default case statements are displayed when no `SwitchWhen ` match the `switch` value.
199+ * Default case statements are displayed when no `NgSwitchWhen ` match the `switch` value.
200200 *
201201 * Example:
202202 *
203203 * ```
204- * <template [switch-default]>...</template>
204+ * <template [ng- switch-default]>...</template>
205205 * ```
206206 *
207207 * @exportedAs angular2/directives
208208 */
209209@Directive ( {
210- selector : '[switch-default]'
210+ selector : '[ng- switch-default]'
211211} )
212- export class SwitchDefault {
213- constructor ( viewContainer : ViewContainerRef , protoViewRef : ProtoViewRef , @Parent ( ) sswitch : Switch ) {
212+ export class NgSwitchDefault {
213+ constructor ( viewContainer : ViewContainerRef , protoViewRef : ProtoViewRef , @Parent ( ) sswitch : NgSwitch ) {
214214 sswitch . _registerView ( _whenDefault , new SwitchView ( viewContainer , protoViewRef ) ) ;
215215 }
216216}
0 commit comments