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