File tree Expand file tree Collapse file tree 5 files changed +50
-0
lines changed Expand file tree Collapse file tree 5 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import {RadioAccessibilityDemo} from './radio/radio-a11y';
15
15
import { DatepickerAccessibilityDemo } from './datepicker/datepicker-a11y' ;
16
16
import { InputAccessibilityDemo } from './input/input-a11y' ;
17
17
import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
18
+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
18
19
19
20
20
21
@NgModule ( {
@@ -48,6 +49,7 @@ export class AccessibilityRoutingModule {}
48
49
InputAccessibilityDemo ,
49
50
RadioAccessibilityDemo ,
50
51
SliderAccessibilityDemo ,
52
+ SlideToggleAccessibilityDemo ,
51
53
]
52
54
} )
53
55
export class AccessibilityDemoModule { }
Original file line number Diff line number Diff line change @@ -27,5 +27,6 @@ export class AccessibilityDemo {
27
27
{ name : 'Input' , route : 'input' } ,
28
28
{ name : 'Radio buttons' , route : 'radio' } ,
29
29
{ name : 'Slider' , route : 'slider' } ,
30
+ { name : 'Slide toggle' , route : 'slide-toggle' } ,
30
31
] ;
31
32
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {AccessibilityHome} from './a11y';
10
10
import { DatepickerAccessibilityDemo } from './datepicker/datepicker-a11y' ;
11
11
import { InputAccessibilityDemo } from './input/input-a11y' ;
12
12
import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
13
+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
13
14
14
15
export const ACCESSIBILITY_DEMO_ROUTES : Routes = [
15
16
{ path : '' , component : AccessibilityHome } ,
@@ -23,4 +24,5 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
23
24
{ path : 'input' , component : InputAccessibilityDemo } ,
24
25
{ path : 'radio' , component : RadioAccessibilityDemo } ,
25
26
{ path : 'slider' , component : SliderAccessibilityDemo } ,
27
+ { path : 'slide-toggle' , component : SlideToggleAccessibilityDemo } ,
26
28
] ;
Original file line number Diff line number Diff line change
1
+ < section >
2
+ < h2 > Receive email update (Default slide toggle) </ h2 >
3
+ < md-slide-toggle color ="primary " [(ngModel)] ="emailToggle ">
4
+ Receive email update
5
+ </ md-slide-toggle >
6
+ </ section >
7
+
8
+ < section >
9
+ < h2 > Music (Disabled slide toggle)</ h2 >
10
+ < md-slide-toggle color ="accent " [disabled] ="true " [(ngModel)] ="musicToggle ">
11
+ Music on/off (disabled)
12
+ </ md-slide-toggle >
13
+ </ section >
14
+
15
+ < section >
16
+ < h2 > Terms and conditions (Required slide toggle in a form) </ h2 >
17
+ < form #form ="ngForm " (ngSubmit) ="onFormSubmit() " ngNativeValidate >
18
+ < md-slide-toggle name ="termsToggle " required ngModel >
19
+ I agree to terms and conditions
20
+ </ md-slide-toggle >
21
+ < p >
22
+ < button md-raised-button type ="submit "> Submit</ button >
23
+ </ p >
24
+ </ form >
25
+ </ section >
Original file line number Diff line number Diff line change
1
+ import { Component } from '@angular/core' ;
2
+ import { MdSnackBar } from '@angular/material' ;
3
+
4
+
5
+ @Component ( {
6
+ moduleId : module . id ,
7
+ selector : 'slide-toggle-a11y' ,
8
+ templateUrl : 'slide-toggle-a11y.html'
9
+ } )
10
+ export class SlideToggleAccessibilityDemo {
11
+ emailToggle : boolean = true ;
12
+ termsToggle : boolean = false ;
13
+ musicToggle : boolean = false ;
14
+
15
+ constructor ( private snackBar : MdSnackBar ) { }
16
+
17
+ onFormSubmit ( ) {
18
+ this . snackBar . open ( 'Terms and condistions accepted!' , '' , { duration : 2000 } ) ;
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments