简体   繁体   中英

Angular ngAnimate,ng-view leave animation not working

angular version: 1.6.1

I'm trying to make a fade in/out for my ng-view element. The problem is that only the enter animation works.

html part:

<main class="main" ng-view></main>

app.js

App.animation('.main', function() {
        return {
            enter : function(element, done) {
                TweenMax.set(element,{autoAlpha:0});
                TweenMax.to(element, .4, {autoAlpha: 1, ease: Quad.easeOut, delay: 1});
                done();
            },

            leave : function(element, done) {
                TweenMax.to(element, .4, {autoAlpha: 0, ease: Quad.easeOut});
                done();
            }
        };
    });

Thanks in advance, i appreciate any help you can provide.

            enter : function(element, done) {

                TweenMax.to(element, .4, {autoAlpha: 1, ease: Quad.easeOut, delay: 1, onComplete:done});

            },

            leave : function(element, done) {
                TweenMax.to(element, .4, {autoAlpha: 0, ease: Quad.easeOut, onComplete:done});

            }

css || .main: opacity: 0;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM