MCPcopy Create free account
hub / github.com/angular/components / validate

Method validate

src/aria/private/menu/menu.ts:198–211  ·  view source on GitHub ↗

Returns a set of violations

()

Source from the content-addressed store, hash-verified

196
197 /** Returns a set of violations */
198 validate(): string[] {
199 const violations: string[] = [];
200
201 const values = this.inputs
202 .items()
203 .map(i => i.value())
204 .filter((val): val is V => val !== undefined);
205 const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx);
206 if (duplicates.length > 0) {
207 violations.push(`Duplicate value '${duplicates[0]}' detected inside ngMenu.`);
208 }
209
210 return violations;
211 }
212
213 /** Sets the default state for the menu. */
214 setDefaultState() {

Callers 1

menu.spec.tsFile · 0.45

Calls 3

pushMethod · 0.65
filterMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected