PopupAnimation hook

2 Answers 93 Views
Popup
Jaime
Top achievements
Rank 2
Iron
Iron
Jaime asked on 27 Sep 2022, 04:47 PM | edited on 27 Sep 2022, 05:57 PM

Hi there,

I'm curious as to what would be the best approach in having a function execute once the animation is done. I could do a setTimeout and invoke the function from there but I'm looking for a more elegant solution if there is one.

I was hoping that the PopupAnimation interface and it's underlying class can provide a callback hook for executing code after the animation has finished.

Thank you and looking forward to your response.

 

Cheers!

Jaime

2 Answers, 1 is accepted

Sort by
1
Accepted
Martin Bechev
Telerik team
answered on 30 Sep 2022, 12:43 PM

Hi Jaime,

The open event of the Popup is emitted when the Popup is opened and its animations end. This could be checked in the following demo where the Popup animation duration is set to 2sec:

https://stackblitz.com/edit/angular-wbqkuc

I hope this helps.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Jaime
Top achievements
Rank 2
Iron
Iron
answered on 28 Sep 2022, 05:17 PM

So the solution I did is not Kendo specific but more the angular way. Using the @ViewChildren decorator to get a hold of the popup...

@ViewChildren('popupMenu') private _popupMenus: QueryList<PopupRef>;

// and placing this code in the ngAfterViewInit hook

this._popupMenus.changes.subscribe((menus) => {

if (menus.first) {

// at this point... popup is available and is done with the animation
}
});
Tags
Popup
Asked by
Jaime
Top achievements
Rank 2
Iron
Iron
Answers by
Martin Bechev
Telerik team
Jaime
Top achievements
Rank 2
Iron
Iron
Share this question
or