在使用 ui-router 作为路由的时候,ngAnimate 的状态切换触发事件只触发了 enter 事件,而没有触发 leave 事件。
测试用代码:
// ...
.animation('.html-body', function(){
return {
enter: function(elem, done){
console.log("enter");
done();
},
leave: function(elem, done){
console.log("leave");
done();
}
}
});
观察 console 可知,在不同状态之间切换时,只有 enter 项计入日志,leave 项没有出现。
演示用 Plunk: http://embed.plnkr.co/82mXQqF...
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
闭关修行中......