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

Method setDisabled

src/material/core/private/ripple-loader.ts:125–145  ·  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 // Re-enabling the host should not bring back a ripple that is disabled for every host.
131 const rippleDisabled = disabled || this._isGloballyDisabled();
132 ripple.target.rippleDisabled = rippleDisabled;
133
134 if (!rippleDisabled && !ripple.hasSetUpEvents) {
135 ripple.hasSetUpEvents = true;
136 ripple.renderer.setupTriggerEvents(host);
137 }
138 } else if (disabled) {
139 // Otherwise, set an attribute so we know what the
140 // disabled state should be when the ripple is initialized.
141 host.setAttribute(matRippleDisabled, '');
142 } else {
143 host.removeAttribute(matRippleDisabled);
144 }
145 }
146
147 /**
148 * Handles creating and attaching component internals

Callers 3

ngDoCheckMethod · 0.80
createReenabledRippleFunction · 0.80
_updateRippleDisabledMethod · 0.80

Calls 3

_isGloballyDisabledMethod · 0.95
setupTriggerEventsMethod · 0.80
getMethod · 0.65

Tested by 1

createReenabledRippleFunction · 0.64