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';
1515import { DatepickerAccessibilityDemo } from './datepicker/datepicker-a11y' ;
1616import { InputAccessibilityDemo } from './input/input-a11y' ;
1717import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
18+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
1819
1920
2021@NgModule ( {
@@ -48,6 +49,7 @@ export class AccessibilityRoutingModule {}
4849 InputAccessibilityDemo ,
4950 RadioAccessibilityDemo ,
5051 SliderAccessibilityDemo ,
52+ SlideToggleAccessibilityDemo ,
5153 ]
5254} )
5355export class AccessibilityDemoModule { }
Original file line number Diff line number Diff line change @@ -27,5 +27,6 @@ export class AccessibilityDemo {
2727 { name : 'Input' , route : 'input' } ,
2828 { name : 'Radio buttons' , route : 'radio' } ,
2929 { name : 'Slider' , route : 'slider' } ,
30+ { name : 'Slide toggle' , route : 'slide-toggle' } ,
3031 ] ;
3132}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {AccessibilityHome} from './a11y';
1010import { DatepickerAccessibilityDemo } from './datepicker/datepicker-a11y' ;
1111import { InputAccessibilityDemo } from './input/input-a11y' ;
1212import { SliderAccessibilityDemo } from './slider/slider-a11y' ;
13+ import { SlideToggleAccessibilityDemo } from './slide-toggle/slide-toggle-a11y' ;
1314
1415export const ACCESSIBILITY_DEMO_ROUTES : Routes = [
1516 { path : '' , component : AccessibilityHome } ,
@@ -23,4 +24,5 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
2324 { path : 'input' , component : InputAccessibilityDemo } ,
2425 { path : 'radio' , component : RadioAccessibilityDemo } ,
2526 { path : 'slider' , component : SliderAccessibilityDemo } ,
27+ { path : 'slide-toggle' , component : SlideToggleAccessibilityDemo } ,
2628] ;
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