MCPcopy
hub / github.com/angular/components / focus

Method focus

src/material/chips/chip.ts:348–359  ·  view source on GitHub ↗

Allows for programmatic focusing of the chip.

()

Source from the content-addressed store, hash-verified

346
347 /** Allows for programmatic focusing of the chip. */
348 focus(): void {
349 if (!this.disabled) {
350 // If `focus` is called before `ngAfterViewInit`, we won't have access to the primary action.
351 // This can happen if the consumer tries to focus a chip immediately after it is added.
352 // Queue the method to be called again on init.
353 if (this.primaryAction) {
354 this.primaryAction.focus();
355 } else {
356 this._pendingFocus = true;
357 }
358 }
359 }
360
361 /** Gets the action that contains a specific target node. */
362 _getSourceAction(target: Node): MatChipAction | undefined {

Callers 1

ngAfterViewInitMethod · 0.95

Calls 1

focusMethod · 0.65

Tested by

no test coverage detected