/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
integration/animations/src/app/home.component.ts
56 строк
1 KB
Jessica Janiuk
fix(core): fixes a regression with animate.leave and reordering
20 мар 2026, 01:51
20 мар 2026, 01:51
dfa149d
Код
Авторство
О чём код?
import {Component, AnimationCallbackEvent} from '@angular/core'; import { CdkDragDrop, CdkDropList, CdkDrag, CdkDragPlaceholder, moveItemInArray, } from '@angular/cdk/drag-drop'; @Component({ selector: 'app-home', imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], templateUrl: './app.component.html', styleUrl: './app.component.css', }) export class HomeComponent { movies = [ 'Episode I - The Phantom Menace', 'Episode II - Attack of the Clones', 'Episode III - Revenge of the Sith', ]; testItems = ['A', 'B']; showFallback = true; drop(event: CdkDragDrop<string[]>) { moveItemInArray(this.movies, event.previousIndex, event.currentIndex); } hideAndIntercept() { const el = document.querySelector('.fallback-el'); if (el) { el.addEventListener( 'animationend', (e) => { e.stopImmediatePropagation(); }, true, ); } this.showFallback = false; } shuffleTest() { this.testItems = ['B', 'A']; } removeTest() { this.testItems = ['A']; } onTestLeave(event: AnimationCallbackEvent) { event.animationComplete(); } }