Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute code after Angular Material animations

I'm using Angular Material on a website. Being a responsive-framework, it handles rendering at different window-sizes. When changing the window size, it adds some animations of the layout changing and controls moving around

Example: https://material.angularjs.org/latest/demo/gridList (open the link and resize the window)

enter image description here

I have some WebGL canvas on the tiles shown on the example that need to be redrawn after the animation completes (and the container has it's final dimensions).

How can I get some callback or promise for the UI animations to be complete?

like image 460
ButterDog Avatar asked May 06 '16 21:05

ButterDog


1 Answers

The solution for this problem, is to add the attribute md-on-layout to md-grid-list (docs).

Example:

HTML:

<md-grid-list md-on-layout="update($event)" ...>
  <md-grid-tile>...</md-grid-tile>
</md-grid-list>

Controller:

$scope.update = function($event){
    console.log("Updating layout."); 
}
like image 74
ButterDog Avatar answered Oct 25 '22 04:10

ButterDog