AngularJS - 动画 ng-view 转换 [英] AngularJS - Animate ng-view transitions
问题描述
我有 2 个 html 页面,welcome.html
和 login.html
两者都插入"到 index.html
中,取决于URL 通过 ngview
属性和路由器提供程序,作为我的 AngularJS 应用程序的一部分.
I have 2 html pages, welcome.html
and login.html
both of which are "inserted" into index.html
dependending on the URL via an ngview
attribute and router provider, as part of my AngularJS app.
可以在 AngularJS 主页的连接后端下找到一个示例.
An example of this can be found on the AngularJS home page under Wire up a Backend.
我的问题:有没有办法为 welcome.html
和 login.html
之间的过渡设置动画?
My question: Is there a way to animate the transition between welcome.html
and login.html
?
推荐答案
Angularjs 1.1.4 现在引入了 ng-animate
指令来帮助动画不同的元素,特别是 ng-view.
Angularjs 1.1.4 has now introduced the ng-animate
directive to help animating different elements, in particular ng-view.
UPDATE 从 angularjs 1.2 开始,动画的工作方式发生了巨大变化,现在大部分是用 CSS 控制的,无需设置 javascript 回调等.您可以查看 Moo 年更新教程.@dfsq 在评论中指出一组不错的例子.
UPDATE as of angularjs 1.2, the way animations work has changed drastically, most of it is now controlled with CSS, without having to setup javascript callbacks, etc.. You can check the updated tutorial on Year Of Moo. @dfsq pointed out in the comments a nice set of examples.
这篇关于AngularJS - 动画 ng-view 转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!