Allows for programmatic focusing of the chip.
()
| 367 | |
| 368 | /** Allows for programmatic focusing of the chip. */ |
| 369 | focus(): void { |
| 370 | if (!this.disabled) { |
| 371 | // If `focus` is called before `ngAfterViewInit`, we won't have access to the primary action. |
| 372 | // This can happen if the consumer tries to focus a chip immediately after it is added. |
| 373 | // Queue the method to be called again on init. |
| 374 | if (this.primaryAction) { |
| 375 | this.primaryAction.focus(); |
| 376 | } else { |
| 377 | this._pendingFocus = true; |
| 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | /** Gets the action that contains a specific target node. */ |
| 383 | _getSourceAction(target: Node): MatChipAction | undefined { |