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
import { SnackBarAccessibilityDemo } from './snack-bar/snack-bar-a11y' ;
21
22
import { SelectAccessibilityDemo } from './select/select-a11y' ;
22
23
@@ -54,6 +55,7 @@ export class AccessibilityRoutingModule {}
54
55
ProgressSpinnerAccessibilityDemo ,
55
56
RadioAccessibilityDemo ,
56
57
SliderAccessibilityDemo ,
58
+ SlideToggleAccessibilityDemo ,
57
59
SnackBarAccessibilityDemo ,
58
60
SelectAccessibilityDemo ,
59
61
]
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ 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
{ name : 'Snack bar' , route : 'snack-bar' } ,
33
34
{ name : 'Select' , route : 'select' } ,
34
35
] ;
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
import { SnackBarAccessibilityDemo } from './snack-bar/snack-bar-a11y' ;
16
17
import { SelectAccessibilityDemo } from './select/select-a11y' ;
17
18
@@ -29,6 +30,7 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
29
30
{ path : 'progress-spinner' , component : ProgressSpinnerAccessibilityDemo } ,
30
31
{ path : 'radio' , component : RadioAccessibilityDemo } ,
31
32
{ path : 'slider' , component : SliderAccessibilityDemo } ,
33
+ { path : 'slide-toggle' , component : SlideToggleAccessibilityDemo } ,
32
34
{ path : 'snack-bar' , component : SnackBarAccessibilityDemo } ,
33
35
{ path : 'select' , component : SelectAccessibilityDemo } ,
34
36
] ;
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