天道酬勤,学无止境

hammer

ngFor 与 Angular 7 中的 Hammer JS 滑动功能(ngFor with Hammer JS swipe function in Angular 7)

问题 在 angular 中使用带有 *ngFor 的 Hammer js 滑动功能时。预期的结果是滑动特定的瓷砖索引,该瓷砖将被删除。 但是通过这样做,动画现在不起作用。 我所做的代码在以下链接中: https://stackblitz.com/edit/angular-animations-lib-demo-ahykzr?file=src%2Fapp%2Fapp.component.html 回答1 Arjun,你使用一个独特的变量来控制动画,这是你拥有的所有 div [@cardAnimator]="animationState" 因此,当更改变量时,所有 div 都会被动画化。 您需要使用变量数组 将 animationState 声明为字符串数组 animationState: string[]=[]; en startAnimation 和 resetAnimation 使用数组 startAnimation(state,index) { console.log(state) console.log(index) this.asd = index; if (!this.animationState[index]) { this.animationState[index] = state; } } resetAnimationState(index) { this

2021-10-30 10:15:43    分类:技术分享    angular   hammer.js   hammer

ngFor with Hammer JS swipe function in Angular 7

While using Hammer js swipe function with *ngFor in angular.The result expected was a swipe for particular index of tile and that tile will be removed. But by doing that the animation is not working now. the code which i have done is in below link: https://stackblitz.com/edit/angular-animations-lib-demo-ahykzr?file=src%2Fapp%2Fapp.component.html

2021-10-29 11:48:35    分类:问答    angular   hammer.js   hammer