Hey folks,
I´ve been playing with the Ionic Animations API on a side project im working on i have been strunggling with the next piece of code:
@ViewChild('chevron', { static: false }) chevron: ElementRef;
private chevronAnimation: Animation;
constructor(private animationCtrl: AnimationController) { }
toggleDropdown() {
this.isDropdownExpanded = !this.isDropdownExpanded;
if (!this.chevronAnimation) {
this.chevronAnimation = this.animationCtrl.create().addElement(this.chevron.nativeElement).fromTo('transform', 'rotate(0deg)', 'rotate(180deg)').easing('ease').duration(100);
}
if (this.isDropdownExpanded) {
this.chevronAnimation.direction('reverse').play();
} else {
this.chevronAnimation.direction('normal').play();
}
}
As you can see its a simple chevron i want to rotate when user fires the method toggleDropdown. No errors, event is fired, logic works correctly but the animation isnt played.
Thanks in advice.