我是AngularJS的新手,想要实现路由依赖的页面转换.例如,我希望页面向左滑动,向右滑动或根据路线向下滑动.
下面我的'Plunker'通过听取$ routeChangeSuccess事件然后将一个特定于过渡风格的CSS类应用于进入和离开视图来实现这一点(灵感来自http://phillippuleo.com/articles/scalable-approach-page-transitions- angularjs):
http://plnkr.co/edit/ee4CHfb8kZC1WxtDM9wr?p=preview
但是,在事件监听器中调用$ scope.$ apply()会使AngularJS发出错误消息'$ digest has progress in'.但是如果我不调用$ scope.$ apply()则不会更新离开视图的CSS类,并且动画无法正常工作.
这里发生了什么?
angularjs ×1