|
1 | 1 | import {Component} from '@angular/core'; |
2 | | -import { |
3 | | - CdkDragDrop, |
4 | | - CdkDropList, |
5 | | - CdkDrag, |
6 | | - CdkDragPlaceholder, |
7 | | - moveItemInArray, |
8 | | -} from '@angular/cdk/drag-drop'; |
9 | | - |
10 | | -// We want to verify that dragging an item does not result in any items disappearing |
11 | | -// when they have an enter/leave animation. |
| 2 | +import {RouterLink, RouterOutlet} from '@angular/router'; |
12 | 3 |
|
13 | 4 | @Component({ |
14 | 5 | selector: 'app-root', |
15 | | - imports: [CdkDropList, CdkDrag, CdkDragPlaceholder], |
16 | | - templateUrl: './app.component.html', |
17 | | - styleUrl: './app.component.css', |
| 6 | + imports: [RouterOutlet, RouterLink], |
| 7 | + template: ` |
| 8 | + <nav> |
| 9 | + <a routerLink="/" id="home-link">Home</a> | |
| 10 | + <a routerLink="/nested" id="nested-link">Nested Animations</a> |
| 11 | + </nav> |
| 12 | + <router-outlet></router-outlet> |
| 13 | + `, |
18 | 14 | }) |
19 | | -export class AppComponent { |
20 | | - movies = [ |
21 | | - 'Episode I - The Phantom Menace', |
22 | | - 'Episode II - Attack of the Clones', |
23 | | - 'Episode III - Revenge of the Sith', |
24 | | - ]; |
25 | | - |
26 | | - showFallback = true; |
27 | | - |
28 | | - drop(event: CdkDragDrop<string[]>) { |
29 | | - moveItemInArray(this.movies, event.previousIndex, event.currentIndex); |
30 | | - } |
31 | | - |
32 | | - hideAndIntercept() { |
33 | | - const el = document.querySelector('.fallback-el'); |
34 | | - if (el) { |
35 | | - el.addEventListener( |
36 | | - 'animationend', |
37 | | - (e) => { |
38 | | - e.stopImmediatePropagation(); |
39 | | - }, |
40 | | - true, |
41 | | - ); |
42 | | - } |
43 | | - this.showFallback = false; |
44 | | - } |
45 | | -} |
| 15 | +export class AppComponent {} |
0 commit comments