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

Method setDisabled

src/material/core/private/ripple-loader.ts:125–143  ·  view source on GitHub ↗

Sets the disabled state on the ripple instance corresponding to the given host element.

(host: HTMLElement, disabled: boolean)

Source from the content-addressed store, hash-verified

123
124 /** Sets the disabled state on the ripple instance corresponding to the given host element. */
125 setDisabled(host: HTMLElement, disabled: boolean): void {
126 const ripple = this._hosts.get(host);
127
128 // If the ripple has already been instantiated, just disable it.
129 if (ripple) {
130 ripple.target.rippleDisabled = disabled;
131
132 if (!disabled && !ripple.hasSetUpEvents) {
133 ripple.hasSetUpEvents = true;
134 ripple.renderer.setupTriggerEvents(host);
135 }
136 } else if (disabled) {
137 // Otherwise, set an attribute so we know what the
138 // disabled state should be when the ripple is initialized.
139 host.setAttribute(matRippleDisabled, '');
140 } else {
141 host.removeAttribute(matRippleDisabled);
142 }
143 }
144
145 /**
146 * Handles creating and attaching component internals

Callers 2

ngDoCheckMethod · 0.80
_updateRippleDisabledMethod · 0.80

Calls 2

setupTriggerEventsMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected