Animation error when using *ngIf on animation element
See original GitHub issueFrom @Plamen5kov on November 14, 2016 11:55
From @MaklaCof on November 11, 2016 21:38
I get error when variable in *ngIf is changed:
> [JS ] EXCEPTION: Uncaught (in promise): Error: Animation cancelled.
[JS ] ORIGINAL STACKTRACE:
[JS ] Error: Uncaught (in promise): Error: Animation cancelled.
[JS ] at resolvePromise (/data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:416:31)
[JS ] at resolvePromise (/data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:401:17)
[JS ] at /data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:17
[JS ] at ZoneDelegate.invokeTask (/data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37)
[JS ] at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (/data/data/com.telerik.Mobile/files/app/tns_modules/@angular/core/bundles/core.umd.js:6233:41)
[JS ] at ZoneDelegate.invokeTask (/data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:42)
[JS ] at Zone.runTask (/data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:123:47)
[JS ] at drainMicroTaskQueue (/data/data/com.telerik.Mobile/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:355:35)
[JS ] Unhandled Promise rejection: Animation cancelled. ; Zone: angular ; Task: Promise.then ; Value: Error: Animation cancelled. Error: Animation cancelled.
[JS ] at Animation._rejectAnimationFinishedPromise (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/animation/animation-common.js:110:22)
[JS ] at Animation._onAndroidAnimationCancel (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/animation/animation.js:113:14)
[JS ] at Animation._animatorListener.android.animation.Animator.AnimatorListener.onAnimationCancel (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/animation/animation.js:53:22)
[JS ] at Animation.cancel (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/animation/animation.js:92:27)
[JS ] at KeyframeAnimation.cancel (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/animation/keyframe-animation.js:105:31)
[JS ] at Label.View._unregisterAllAnimations (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/core/view-common.js:1114:27)
[JS ] at Style._resetCssValues (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/styling/style.js:925:20)
[JS ] at CssState.apply (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/styling/style-scope.js:46:25)
[JS ] at Label.View.applyCssState (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/core/view-common.js:1201:24)
[JS ] at Label.View._onCssStateChange (/data/data/com.telerik.Mobile/files/app/tns_modules/ui/core/view-common.js:1194:14)
[JS ] Error: Uncaught (in promise): Error: Animation cancelled.
HTML:
<Label class="fa fa-spin" text="" *ngIf="isRunning"></Label>
CSS:
`.fa {
font-family: FontAwesome;
font-size: 24;
}
.fa-spin {
animation-name: fa-spin;
animation-duration: 4;
animation-iteration-count: infinite;
animation-timing-function: linear;
vertical-align: middle;
text-align: center;
}
@keyframes fa-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
TS:
export class HomeComponent implements OnInit
{
isRunning = false;
constructor(private router: Router, private page: Page, private zone: NgZone)
{
}
parseResponse(data: any)
{
this.zone.run(() =>
{
if (typeof data.isRunning !== "undefined" && data.isRunning !== null)
this.isRunning = data.isRunning;
});
}
}
I hope code is readable, because code formatting is not working. The code works, even error is raised.
Copied from original issue: NativeScript/nativescript-cli#2218
Copied from original issue: NativeScript/NativeScript#3089
Issue Analytics
- State:
- Created 7 years ago
- Comments:14 (5 by maintainers)
Top Results From Across the Web
angular 6 animation *ngIf, transition not work - Stack Overflow
Angular is unable to calculate the transition between the closed / open states as the element simply does not exist when isMenuOpen is...
Read more >Angular: using animations with NgIf - Useful Development
The component has an input property called show. When set to true the component needs to add the content to the dom, in...
Read more >Get Better Angular UX Using 4 Animation Techniques - Auth0
The animations array in the component decorator ( addToCartText ) applies a horizontal transform to the element as it enters and leaves the...
Read more >Angular Ngif Animation Bug - StackBlitz
import { Component } from '@angular/core';. @Component({. selector: 'my-app',. templateUrl: './app.component.html',. styleUrls: [ './app.component.css' ]. }).
Read more >Developer Guide: Animations - AngularJS: API
When nesting elements with structural animations, such as ngIf , into elements that have class-based animations such as ngClass , it sometimes happens...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think I still see this, but in:
NativeScript Vue
IOS
nativescript/ios: 7.1.1
vue: 2.6.12
Error:
@NickIliev
Here is the playground demonstrating the error I am getting.
A few notes while creating this playground:
*ngIf="val"
and[class.animate]="val"
to trigger the animation.If you have any questions, let me know! Thanks for your help.