File tree Expand file tree Collapse file tree 11 files changed +29
-13
lines changed
select-error-state-matcher Expand file tree Collapse file tree 11 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 4
4
5
5
< h4 > mat-select</ h4 >
6
6
< mat-form-field >
7
- < mat-select placeholder ="Choose an option " [disabled] ="disableSelect.value ">
7
+ < mat-label > Choose an option</ mat-label >
8
+ < mat-select [disabled] ="disableSelect.value ">
8
9
< mat-option value ="option1 "> Option 1</ mat-option >
9
10
< mat-option value ="option2 " disabled > Option 2 (disabled)</ mat-option >
10
11
< mat-option value ="option3 "> Option 3</ mat-option >
@@ -13,7 +14,8 @@ <h4>mat-select</h4>
13
14
14
15
< h4 > native html select</ h4 >
15
16
< mat-form-field >
16
- < select matNativeControl placeholder ="Choose an option " [disabled] ="disableSelect.value ">
17
+ < mat-label > Choose an option</ mat-label >
18
+ < select matNativeControl [disabled] ="disableSelect.value ">
17
19
< option value ="" selected > </ option >
18
20
< option value ="volvo "> Volvo</ option >
19
21
< option value ="saab " disabled > Saab</ option >
Original file line number Diff line number Diff line change 1
1
< h4 > mat-select</ h4 >
2
2
< mat-form-field >
3
- < mat-select placeholder ="Choose one " [formControl] ="selected " [errorStateMatcher] ="matcher ">
3
+ < mat-label > Choose one</ mat-label >
4
+ < mat-select [formControl] ="selected " [errorStateMatcher] ="matcher ">
4
5
< mat-option > Clear</ mat-option >
5
6
< mat-option value ="valid "> Valid option</ mat-option >
6
7
< mat-option value ="invalid "> Invalid option</ mat-option >
@@ -14,7 +15,8 @@ <h4>mat-select</h4>
14
15
15
16
< h4 > native html select</ h4 >
16
17
< mat-form-field class ="demo-full-width ">
17
- < select matNativeControl placeholder ="Choose one " [formControl] ="nativeSelectFormControl " [errorStateMatcher] ="matcher ">
18
+ < mat-label > Choose one</ mat-label >
19
+ < select matNativeControl [formControl] ="nativeSelectFormControl " [errorStateMatcher] ="matcher ">
18
20
< option value =""> </ option >
19
21
< option value ="valid " selected > Valid option</ option >
20
22
< option value ="invalid "> Invalid option</ option >
Original file line number Diff line number Diff line change 1
1
< form >
2
2
< h4 > mat-select</ h4 >
3
3
< mat-form-field >
4
- < mat-select placeholder ="Favorite food " [(ngModel)] ="selectedValue " name ="food ">
4
+ < mat-label > Favorite food</ mat-label >
5
+ < mat-select [(ngModel)] ="selectedValue " name ="food ">
5
6
< mat-option *ngFor ="let food of foods " [value] ="food.value ">
6
7
{{food.viewValue}}
7
8
</ mat-option >
@@ -10,7 +11,8 @@ <h4>mat-select</h4>
10
11
< p > Selected food: {{selectedValue}} </ p >
11
12
< h4 > native html select</ h4 >
12
13
< mat-form-field >
13
- < select matNativeControl placeholder ="Favorite car " [(ngModel)] ="selectedCar " name ="car ">
14
+ < mat-label > Favorite car</ mat-label >
15
+ < select matNativeControl [(ngModel)] ="selectedCar " name ="car ">
14
16
< option value ="" selected > </ option >
15
17
< option *ngFor ="let car of cars " [value] ="car.value ">
16
18
{{car.viewValue}}
Original file line number Diff line number Diff line change 1
1
< h4 > mat select</ h4 >
2
2
< mat-form-field >
3
- < mat-select placeholder ="Favorite animal " [formControl] ="animalControl " required >
3
+ < mat-label > Favorite animal</ mat-label >
4
+ < mat-select [formControl] ="animalControl " required >
4
5
< mat-option > --</ mat-option >
5
6
< mat-option *ngFor ="let animal of animals " [value] ="animal ">
6
7
{{animal.name}}
Original file line number Diff line number Diff line change 1
1
< mat-form-field >
2
- < mat-select placeholder ="Toppings " [formControl] ="toppings " multiple >
2
+ < mat-label > Toppings</ mat-label >
3
+ < mat-select [formControl] ="toppings " multiple >
3
4
< mat-option *ngFor ="let topping of toppingList " [value] ="topping "> {{topping}}</ mat-option >
4
5
</ mat-select >
5
6
</ mat-form-field >
Original file line number Diff line number Diff line change 1
1
< mat-form-field >
2
- < mat-select placeholder ="Select an option " disableRipple >
2
+ < mat-label > Select an option</ mat-label >
3
+ < mat-select disableRipple >
3
4
< mat-option value ="1 "> Option 1</ mat-option >
4
5
< mat-option value ="2 "> Option 2</ mat-option >
5
6
< mat-option value ="3 "> Option 3</ mat-option >
Original file line number Diff line number Diff line change 1
1
< h4 > mat-select</ h4 >
2
2
< mat-form-field >
3
- < mat-select placeholder ="Pokemon " [formControl] ="pokemonControl ">
3
+ < mat-label > Pokemon</ mat-label >
4
+ < mat-select [formControl] ="pokemonControl ">
4
5
< mat-option > -- None --</ mat-option >
5
6
< mat-optgroup *ngFor ="let group of pokemonGroups " [label] ="group.name "
6
7
[disabled] ="group.disabled ">
@@ -13,6 +14,7 @@ <h4>mat-select</h4>
13
14
14
15
< h4 > native html select</ h4 >
15
16
< mat-form-field >
17
+ < mat-label > Cars</ mat-label >
16
18
< select matNativeControl >
17
19
< optgroup label ="Swedish Cars ">
18
20
< option value ="volvo "> volvo</ option >
Original file line number Diff line number Diff line change 1
1
< h4 > Basic mat-select</ h4 >
2
2
< mat-form-field >
3
- < mat-select placeholder ="Favorite food ">
3
+ < mat-label > Favorite food</ mat-label >
4
+ < mat-select >
4
5
< mat-option *ngFor ="let food of foods " [value] ="food.value ">
5
6
{{food.viewValue}}
6
7
</ mat-option >
@@ -9,6 +10,7 @@ <h4>Basic mat-select</h4>
9
10
10
11
< h4 > Basic native select</ h4 >
11
12
< mat-form-field >
13
+ < mat-label > Cars</ mat-label >
12
14
< select matNativeControl required >
13
15
< option value ="volvo "> Volvo</ option >
14
16
< option value ="saab "> Saab</ option >
Original file line number Diff line number Diff line change 1
1
< mat-form-field >
2
- < mat-select placeholder ="Panel color " [formControl] ="panelColor "
2
+ < mat-label > Panel color</ mat-label >
3
+ < mat-select [formControl] ="panelColor "
3
4
panelClass ="example-panel-{{panelColor.value}} ">
4
5
< mat-option value ="red "> Red</ mat-option >
5
6
< mat-option value ="green "> Green</ mat-option >
Original file line number Diff line number Diff line change 1
1
< h4 > mat-select</ h4 >
2
2
< mat-form-field >
3
- < mat-select placeholder ="State ">
3
+ < mat-label > State</ mat-label >
4
+ < mat-select >
4
5
< mat-option > None</ mat-option >
5
6
< mat-option *ngFor ="let state of states " [value] ="state "> {{state}}</ mat-option >
6
7
</ mat-select >
Original file line number Diff line number Diff line change 1
1
< mat-form-field >
2
+ < mat-label > Select an option</ mat-label >
2
3
< mat-select [(value)] ="selected ">
3
4
< mat-option > None</ mat-option >
4
5
< mat-option value ="option1 "> Option 1</ mat-option >
You can’t perform that action at this time.
0 commit comments