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';
1717import { InputAccessibilityDemo } from './input/input-a11y' ;
1818import { ProgressSpinnerAccessibilityDemo } from './progress-spinner/progress-spinner-a11y' ;
1919import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
20+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
2021import { SnackBarAccessibilityDemo } from './snack-bar/snack-bar-a11y' ;
2122import { SelectAccessibilityDemo } from './select/select-a11y' ;
2223
@@ -54,6 +55,7 @@ export class AccessibilityRoutingModule {}
5455 ProgressSpinnerAccessibilityDemo ,
5556 RadioAccessibilityDemo ,
5657 SliderAccessibilityDemo ,
58+ SlideToggleAccessibilityDemo ,
5759 SnackBarAccessibilityDemo ,
5860 SelectAccessibilityDemo ,
5961 ]
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export class AccessibilityDemo {
2929 { name : 'Progress spinner' , route : 'progress-spinner' } ,
3030 { name : 'Radio buttons' , route : 'radio' } ,
3131 { name : 'Slider' , route : 'slider' } ,
32+ { name : 'Slide toggle' , route : 'slide-toggle' } ,
3233 { name : 'Snack bar' , route : 'snack-bar' } ,
3334 { name : 'Select' , route : 'select' } ,
3435 ] ;
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {IconAccessibilityDemo} from './icon/icon-a11y';
1212import { InputAccessibilityDemo } from './input/input-a11y' ;
1313import { ProgressSpinnerAccessibilityDemo } from './progress-spinner/progress-spinner-a11y' ;
1414import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
15+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
1516import { SnackBarAccessibilityDemo } from './snack-bar/snack-bar-a11y' ;
1617import { SelectAccessibilityDemo } from './select/select-a11y' ;
1718
@@ -29,6 +30,7 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
2930 { path : 'progress-spinner' , component : ProgressSpinnerAccessibilityDemo } ,
3031 { path : 'radio' , component : RadioAccessibilityDemo } ,
3132 { path : 'slider' , component : SliderAccessibilityDemo } ,
33+ { path : 'slide-toggle' , component : SlideToggleAccessibilityDemo } ,
3234 { path : 'snack-bar' , component : SnackBarAccessibilityDemo } ,
3335 { path : 'select' , component : SelectAccessibilityDemo } ,
3436] ;
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