Returns a set of violations
()
| 172 | |
| 173 | /** Returns a set of violations */ |
| 174 | validate(): string[] { |
| 175 | const violations: string[] = []; |
| 176 | |
| 177 | const values = this.inputs.items().map(w => w.value()); |
| 178 | const duplicates = values.filter((val, idx) => values.indexOf(val) !== idx); |
| 179 | if (duplicates.length > 0) { |
| 180 | violations.push(`Duplicate value '${duplicates[0]}' detected inside ngToolbar.`); |
| 181 | } |
| 182 | |
| 183 | return violations; |
| 184 | } |
| 185 | |
| 186 | /** Handles keydown events for the toolbar. */ |
| 187 | onKeydown(event: KeyboardEvent) { |