Sets the disabled state on the ripple instance corresponding to the given host element.
(host: HTMLElement, disabled: boolean)
| 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 |