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

Method focus

src/material/chips/chip.ts:369–380  ·  view source on GitHub ↗

Allows for programmatic focusing of the chip.

()

Source from the content-addressed store, hash-verified

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 {

Callers 1

ngAfterViewInitMethod · 0.95

Calls 1

focusMethod · 0.65

Tested by

no test coverage detected