2016-08-23 26 views
0

我當前遇到ngAnimate和ngMessages的問題。當消息出現時,我可以動畫,但消失時不會。ngAnimate - 使用ngMessages發佈

如果任何人都可以幫助我,因爲文檔對我來說似乎不是很「清楚」。

這裏是我的HTML:

<div ng-messages="loginError" class="login-error" flex layout layout-align="center center"> 
    <p ng-message="invalid_credentials">Combinaison d'email et de mot de passe <strong>invalide.</strong></p> 
    <p ng-message="could_not_create_token">Impossible de créer le jeton</p> 
    <p ng-message="unknown_error">Erreur inconnue.</p> 
</div> 

這是我的CSS:

.login-error { 
    color: #DD2C00; 
    -webkit-transition: all linear 1s; 
    -moz-transition: all linear 1s; 
    -o-transition: all linear 1s; 
    transition: all linear 1s; 
    max-height: 0; 
    opacity: 0; 
} 

.login-error.ng-active, .login-error.ng-active.ng-active-add-active { 
    max-height: 30px; 
    opacity: 1; 
} 

.login-error.ng-inactive, .login-error.ng-active.ng-inactive-add { 
    max-height: 0; 
    opacity: 0; 
} 

回答

0
.login-error { 
    color: #DD2C00; 
    -webkit-transition: all linear 0.5s; 
    -moz-transition: all linear 0.5s; 
    -o-transition: all linear 0.5s; 
    transition: all linear 0.5s; 
} 

.login-error.ng-active { 
    max-height: 30px; 
} 

.login-error.ng-inactive { 
    max-height: 0; 
} 

.login-error-msg { 
    -webkit-transition: all linear 0.5s; 
    -moz-transition: all linear 0.5s; 
    -o-transition: all linear 0.5s; 
    transition: all linear 0.5s; 
} 

.login-error-msg.ng-enter { 
    opacity: 0; 
    max-height: 0; 
} 

.login-error-msg.ng-enter-active { 
    opacity: 1; 
    max-height: 30px; 
} 

.login-error-msg.ng-leave { 
    opacity: 1; 
    max-height: 30px; 
} 

.login-error-msg.ng-leave-active { 
    opacity: 0; 
    max-height: 0; 
} 

解決了我的問題!