0

I would like to manually transition in my html in the controller with javascript code, i.e. a tween library like TweenMax.

So instead of the css:

.ng-enter { /* transition css */ }

I would like to target a javascript function:

function onEnter() { /* transition code */ }

Is there some kind of event/hook api to trigger this?

[Edit1] Regarding the possible duplicate of question, I struggle with applying it to my use case. I also must admit that I have tons of workarounds for the ng-enter, but it is the ng-leave I would like to tap into directly with code instead.

I have a hunch that I need to do something like this in the constructor of the controller:

$scope.$on("SOME_NG_LEAVE_EVENT?", transitionOut); // transitonOut being a function

But I struggle with the documentation, and finding list of events, and how "ng-enter/ng-leave" transforms to a javascript-angualrjs listener.

[Edit2] After alot of browsing, I finally found this: https://docs.angularjs.org/api/ng/service/$animate#leave

But I do not understand how to use it.

Solsiden
  • 673
  • 1
  • 7
  • 22
  • 2
    Possible duplicate of [How to trigger an angularjs animation from a controller method?](http://stackoverflow.com/questions/30082377/how-to-trigger-an-angularjs-animation-from-a-controller-method) – Henrique Barcelos Jun 06 '16 at 13:38

1 Answers1

0

Found answer: http://tech.willandskill.se/animate-ui-view-with-gsap/ https://docs.angularjs.org/api/ngAnimate

It does not specifically answer my problem, where I want the controller itself control the animation, but I should be able to get there from this api.

Solsiden
  • 673
  • 1
  • 7
  • 22