mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
committed by
Kara
parent
372436cb8a
commit
1179868174
@@ -18,6 +18,7 @@ import {InputAccessibilityDemo} from './input/input-a11y';
|
||||
import {ProgressSpinnerAccessibilityDemo} from './progress-spinner/progress-spinner-a11y';
|
||||
import {SliderAccessibilityDemo} from './slider/slider-a11y';
|
||||
import {SnackBarAccessibilityDemo} from './snack-bar/snack-bar-a11y';
|
||||
import {SelectAccessibilityDemo} from './select/select-a11y';
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -54,6 +55,7 @@ export class AccessibilityRoutingModule {}
|
||||
RadioAccessibilityDemo,
|
||||
SliderAccessibilityDemo,
|
||||
SnackBarAccessibilityDemo,
|
||||
SelectAccessibilityDemo,
|
||||
]
|
||||
})
|
||||
export class AccessibilityDemoModule {}
|
||||
|
||||
@@ -30,5 +30,6 @@ export class AccessibilityDemo {
|
||||
{name: 'Radio buttons', route: 'radio'},
|
||||
{name: 'Slider', route: 'slider'},
|
||||
{name: 'Snack bar', route: 'snack-bar'},
|
||||
{name: 'Select', route: 'select'},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import {InputAccessibilityDemo} from './input/input-a11y';
|
||||
import {ProgressSpinnerAccessibilityDemo} from './progress-spinner/progress-spinner-a11y';
|
||||
import {SliderAccessibilityDemo} from './slider/slider-a11y';
|
||||
import {SnackBarAccessibilityDemo} from './snack-bar/snack-bar-a11y';
|
||||
import {SelectAccessibilityDemo} from './select/select-a11y';
|
||||
|
||||
export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
|
||||
{path: '', component: AccessibilityHome},
|
||||
@@ -29,4 +30,5 @@ export const ACCESSIBILITY_DEMO_ROUTES: Routes = [
|
||||
{path: 'radio', component: RadioAccessibilityDemo},
|
||||
{path: 'slider', component: SliderAccessibilityDemo},
|
||||
{path: 'snack-bar', component: SnackBarAccessibilityDemo},
|
||||
{path: 'select', component: SelectAccessibilityDemo},
|
||||
];
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<section>
|
||||
<h2>Single selection</h2>
|
||||
<p>Select your favorite color</p>
|
||||
|
||||
<md-select placeholder="Colors" [(ngModel)]="selectedColor">
|
||||
<md-option *ngFor="let color of colors" [value]="color.value">
|
||||
{{ color.label }}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Multiple selection</h2>
|
||||
<p>Pick toppings for your pizza</p>
|
||||
|
||||
<md-select placeholder="Toppings" [(ngModel)]="selectedTopping" multiple>
|
||||
<md-option *ngFor="let topping of toppings" [value]="topping.value">
|
||||
{{ topping.label }}
|
||||
</md-option>
|
||||
</md-select>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Grouped options</h2>
|
||||
<p>Pick your Pokemon</p>
|
||||
|
||||
<md-select placeholder="Pokemon" [(ngModel)]="selectedPokemon">
|
||||
<md-optgroup *ngFor="let group of pokemon" [label]="group.label">
|
||||
<md-option *ngFor="let creature of group.pokemon" [value]="creature.value">
|
||||
{{ creature.label }}
|
||||
</md-option>
|
||||
</md-optgroup>
|
||||
</md-select>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Colors</h2>
|
||||
|
||||
<div class="select-a11y-spacer">
|
||||
<md-select placeholder="ZIP code" color="primary">
|
||||
<md-option value="2000">2000</md-option>
|
||||
<md-option value="2100">2100</md-option>
|
||||
</md-select>
|
||||
|
||||
<md-select placeholder="State" color="accent">
|
||||
<md-option value="alaska">Alaska</md-option>
|
||||
<md-option value="alabama">Alabama</md-option>
|
||||
</md-select>
|
||||
|
||||
<md-select placeholder="Language" color="warn">
|
||||
<md-option value="english">English</md-option>
|
||||
<md-option value="spanish">Spanish</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
|
||||
<div class="select-a11y-spacer">
|
||||
<md-select placeholder="Digimon" color="primary" multiple>
|
||||
<md-option value="mihiramon">Mihiramon</md-option>
|
||||
<md-option value="sandiramon">Sandiramon</md-option>
|
||||
</md-select>
|
||||
|
||||
<md-select placeholder="Drink" color="accent" multiple>
|
||||
<md-option value="water">Water</md-option>
|
||||
<md-option value="coke">Coke</md-option>
|
||||
</md-select>
|
||||
|
||||
<md-select placeholder="Theme" color="warn" multiple>
|
||||
<md-option value="light">Light</md-option>
|
||||
<md-option value="dark">Dark</md-option>
|
||||
</md-select>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,3 @@
|
||||
.select-a11y-spacer {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
selector: 'select-a11y',
|
||||
templateUrl: 'select-a11y.html',
|
||||
styleUrls: ['select-a11y.css'],
|
||||
})
|
||||
export class SelectAccessibilityDemo {
|
||||
selectedColor: string;
|
||||
selectedTopping: string[];
|
||||
selectedPokemon: string;
|
||||
|
||||
colors = [
|
||||
{value: 'red', label: 'Red'},
|
||||
{value: 'green', label: 'Green'},
|
||||
{value: 'blue', label: 'Blue'},
|
||||
{value: 'cyan', label: 'Cyan'},
|
||||
{value: 'magenta', label: 'Magenta'},
|
||||
{value: 'yellow', label: 'Yellow'},
|
||||
{value: 'black', label: 'Black'},
|
||||
];
|
||||
|
||||
toppings = [
|
||||
{value: 'pepperoni', label: 'Pepperoni'},
|
||||
{value: 'mushrooms', label: 'Mushrooms'},
|
||||
{value: 'onions', label: 'Onions'},
|
||||
{value: 'sausage', label: 'Sausage'},
|
||||
{value: 'bacon', label: 'Bacon'},
|
||||
{value: 'cheese', label: 'Cheese'},
|
||||
{value: 'olives', label: 'Olives'},
|
||||
{value: 'peppers', label: 'Peppers'},
|
||||
{value: 'pineapple', label: 'Pineapple'},
|
||||
{value: 'spinach', label: 'Spinach'},
|
||||
];
|
||||
|
||||
pokemon = [
|
||||
{
|
||||
label: 'Grass',
|
||||
pokemon: [
|
||||
{value: 'bulbasaur', label: 'Bulbasaur'},
|
||||
{value: 'oddish', label: 'Oddish'},
|
||||
{value: 'bellsprout', label: 'Bellsprout'}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Water',
|
||||
pokemon: [
|
||||
{value: 'squirtle', label: 'Squirtle'},
|
||||
{value: 'psyduck', label: 'Psyduck'},
|
||||
{value: 'horsea', label: 'Horsea'}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Fire',
|
||||
disabled: true,
|
||||
pokemon: [
|
||||
{value: 'charmander', label: 'Charmander'},
|
||||
{value: 'vulpix', label: 'Vulpix'},
|
||||
{value: 'flareon', label: 'Flareon'}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: 'Psychic',
|
||||
pokemon: [
|
||||
{value: 'mew', label: 'Mew'},
|
||||
{value: 'mewtwo', label: 'Mewtwo'}
|
||||
]
|
||||
}
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user