Skip to content

Commit 328c5d4

Browse files
zizifncrisbeto
authored andcommitted
docs(cdk/listbox): remove forms validation and validation example (#29391)
(cherry picked from commit e6535b7)
1 parent a083619 commit 328c5d4

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

src/cdk/listbox/listbox.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,6 @@ The CDK Listbox supports both template driven forms and reactive forms.
120120
"region": "listbox"
121121
}) -->
122122

123-
#### Forms validation
124-
125-
The CDK listbox integrates with Angular's form validation API and has the following built-in
126-
validation errors:
127-
128-
- `cdkListboxUnexpectedOptionValues` - Raised when the bound value contains values that do not
129-
appear as option value in the listbox. The validation error contains a `values` property that
130-
lists the invalid values
131-
- `cdkListboxUnexpectedMultipleValues` - Raised when a single-selection listbox is bound to a value
132-
containing multiple selected options.
133-
134-
<!-- example({
135-
"example": "cdk-listbox-forms-validation",
136-
"file": "cdk-listbox-forms-validation-example.ts",
137-
"region": "errors"
138-
}) -->
139-
140123
### Disabling options
141124

142125
You can disable options for selection by setting `cdkOptionDisabled`.

src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,5 @@
2020
}
2121
<p>
2222
Your zodiac sign is: <strong>{{signCtrl.value | json}}</strong>&nbsp;
23-
<button (click)="signCtrl.setValue(['Cat'])">Set: Cat</button>&nbsp;
24-
<button (click)="signCtrl.setValue(['Dragon', 'Snake'])">Set: Dragon, Snake</button>&nbsp;
25-
<button (click)="signCtrl.setValue(['Cat', 'Rat'])">Set: Cat, Rat</button>&nbsp;
2623
<button (click)="signCtrl.setValue([])">Clear</button>
2724
</p>

src/components-examples/cdk/listbox/cdk-listbox-forms-validation/cdk-listbox-forms-validation-example.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,7 @@ export class CdkListboxFormsValidationExample {
4545
if (this.signCtrl.hasError('required')) {
4646
errors.push('You must enter your zodiac sign');
4747
}
48-
if (this.signCtrl.hasError('cdkListboxUnexpectedMultipleValues')) {
49-
errors.push('You can only select one zodiac sign');
50-
}
51-
if (this.signCtrl.hasError('cdkListboxUnexpectedOptionValues')) {
52-
const invalidOptions = this.signCtrl.getError('cdkListboxUnexpectedOptionValues').values;
53-
errors.push(`You entered an invalid zodiac sign: ${invalidOptions[0]}`);
54-
}
48+
5549
return errors.length ? errors : null;
5650
}
5751
// #enddocregion errors

0 commit comments

Comments
 (0)