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

Method _transitionCheckState

src/material/checkbox/checkbox.ts:357–386  ·  view source on GitHub ↗
(newState: TransitionCheckState)

Source from the content-addressed store, hash-verified

355 }
356
357 private _transitionCheckState(newState: TransitionCheckState) {
358 let oldState = this._currentCheckState;
359 let element = this._getAnimationTargetElement();
360
361 if (oldState === newState || !element) {
362 return;
363 }
364 if (this._currentAnimationClass) {
365 element.classList.remove(this._currentAnimationClass);
366 }
367
368 this._currentAnimationClass = this._getAnimationClassForCheckStateTransition(
369 oldState,
370 newState,
371 );
372 this._currentCheckState = newState;
373
374 if (this._currentAnimationClass.length > 0) {
375 element.classList.add(this._currentAnimationClass);
376
377 // Remove the animation class to avoid animation when the checkbox is moved between containers
378 const animationClass = this._currentAnimationClass;
379
380 this._ngZone.runOutsideAngular(() => {
381 setTimeout(() => {
382 element!.classList.remove(animationClass);
383 }, 1000);
384 });
385 }
386 }
387
388 private _emitChangeEvent() {
389 this._controlValueAccessorChangeFn(this.checked);

Callers 2

indeterminateMethod · 0.95
_handleInputClickMethod · 0.95

Calls 4

removeMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected