File tree Expand file tree Collapse file tree 5 files changed +53
-0
lines changed Expand file tree Collapse file tree 5 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {IconAccessibilityDemo} from './icon/icon-a11y';
17
17
import { InputAccessibilityDemo } from './input/input-a11y' ;
18
18
import { ProgressSpinnerAccessibilityDemo } from './progress-spinner/progress-spinner-a11y' ;
19
19
import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
20
+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
20
21
21
22
22
23
@NgModule ( {
@@ -52,6 +53,7 @@ export class AccessibilityRoutingModule {}
52
53
ProgressSpinnerAccessibilityDemo ,
53
54
RadioAccessibilityDemo ,
54
55
SliderAccessibilityDemo ,
56
+ SlideToggleAccessibilityDemo ,
55
57
]
56
58
} )
57
59
export class AccessibilityDemoModule { }
Original file line number Diff line number Diff line change @@ -29,5 +29,6 @@ export class AccessibilityDemo {
29
29
{ name : 'Progress spinner' , route : 'progress-spinner' } ,
30
30
{ name : 'Radio buttons' , route : 'radio' } ,
31
31
{ name : 'Slider' , route : 'slider' } ,
32
+ { name : 'Slide toggle' , route : 'slide-toggle' } ,
32
33
] ;
33
34
}
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {IconAccessibilityDemo} from './icon/icon-a11y';
12
12
import { InputAccessibilityDemo } from './input/input-a11y' ;
13
13
import { ProgressSpinnerAccessibilityDemo } from './progress-spinner/progress-spinner-a11y' ;
14
14
import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
15
+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
15
16
16
17
export const ACCESSIBILITY_DEMO_ROUTES : Routes = [
17
18
{ path : '' , component : AccessibilityHome } ,
@@ -27,4 +28,5 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
27
28
{ path : 'progress-spinner' , component : ProgressSpinnerAccessibilityDemo } ,
28
29
{ path : 'radio' , component : RadioAccessibilityDemo } ,
29
30
{ path : 'slider' , component : SliderAccessibilityDemo } ,
31
+ { path : 'slide-toggle' , component : SlideToggleAccessibilityDemo } ,
30
32
] ;
Original file line number Diff line number Diff line change
1
+ < section >
2
+ < h2 > Receive email update</ h2 >
3
+ < p > Showing a toggle to manage whether receive email update.</ p >
4
+ < md-slide-toggle color ="primary " [(ngModel)] ="emailToggle ">
5
+ Receive email update
6
+ </ md-slide-toggle >
7
+ </ section >
8
+
9
+ < section >
10
+ < h2 > Music</ h2 >
11
+ < p > Showing a disabled toggle to control music on/off status.</ p >
12
+ < md-slide-toggle color ="accent " [disabled] ="true " [(ngModel)] ="musicToggle ">
13
+ Music {{musicToggle ? 'on' : 'off'}} (disabled)
14
+ </ md-slide-toggle >
15
+ </ section >
16
+
17
+ < section >
18
+ < h2 > Terms and conditions</ h2 >
19
+ < p > Showing a required toggle to accept terms and conditions in a form.</ p >
20
+ < form #form ="ngForm " (ngSubmit) ="onFormSubmit() " ngNativeValidate >
21
+ < md-slide-toggle name ="termsToggle " required ngModel >
22
+ I agree to terms and conditions
23
+ </ md-slide-toggle >
24
+ < p >
25
+ < button md-raised-button type ="submit "> Submit</ button >
26
+ </ p >
27
+ </ form >
28
+ </ 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