TweenMax补间后的AngularJS ng-animate错误

时间:2014-08-05 13:56:35

标签: javascript jquery angularjs ng-animate

我正在设置Javascript动画,以便我可以制作幻灯片动画。我需要在Javascript中执行此操作,因为我想将父级和父级父级设置为不同的属性,以便在两个幻灯片位于其中时允许滑动,以获得平滑的动画。

我遇到的问题是,由于某些原因,ng-animate会出现某种需要作为函数的对象的错误。

object is not a function
at http://anybet.kenneth.og/wp-content/themes/dev/js/components/angular-animate/angular-animate.js:558:35

稍后,当它仍然没有删除视图时,它往往会变得更糟,显然

TypeError: object is not a function
at http://anybet.kenneth.og//wp-content/themes/dev/js/components/angular-animate/angular-animate.js:558:35
at Array.forEach (native)
at forEach (http://anybet.kenneth.og//wp-content/themes/dev/js/components/angular/angular.js:324:11)
at Object.cancel (http://anybet.kenneth.og//wp-content/themes/dev/js/components/angular-animate/angular-animate.js:557:15)
at HTMLDivElement.<anonymous> (http://anybet.kenneth.og//wp-content/themes/dev/js/components/angular-animate/angular-animate.js:978:38)
at HTMLDivElement.fn (http://anybet.kenneth.og//wp-content/themes/dev/js/components/jquery/dist/jquery.js:5214:19)
at HTMLDivElement.jQuery.event.dispatch (http://anybet.kenneth.og//wp-content/themes/dev/js/components/jquery/dist/jquery.js:4641:9)
at HTMLDivElement.elemData.handle (http://anybet.kenneth.og//wp-content/themes/dev/js/components/jquery/dist/jquery.js:4309:46)
at Object.jQuery.event.trigger (http://anybet.kenneth.og//wp-content/themes/dev/js/components/jquery/dist/jquery.js:4550:12)
at jQuery.fn.extend.triggerHandler (http://anybet.kenneth.og//wp-content/themes/dev/js/components/jquery/dist/jquery.js:5266:24) 

当它尝试触发$ complete函数

时会发生这种情况

结构是这样的:

<div class="subpages-container">
    <div class="subpages">
        <div class="subpage slide-animation" ui-view="subpage" title="{{activeUrl}}"></div>
    </div>
</div>

我的幻灯片动画目前看起来像这样:

do( $app = angular.module('anybetApp') ) ->


'use strict'


###*
 * Slide animation for use with ng-animate that listens to .slide-aniamtion
 * @return {Object} Gives back a Object that is compatible with ng-animate and injects
###

$app.animation '.slide-animation', ->

    leave: ( $el, $complete ) ->

        TweenMax.fromTo( $el, .2, { x: '-100%' }, { x: '0%', onComplete: $complete } )

它曾经包含更多并且实际上有效,但我已经非常非常小,并试图弄清楚发生了什么但却无法做到。

如果我这样做,$ complete()有效

do( $app = angular.module('anybetApp') ) ->


'use strict'


###*
 * Slide animation for use with ng-animate that listens to .slide-aniamtion
 * @return {Object} Gives back a Object that is compatible with ng-animate and injects
###

$app.animation '.slide-animation', ->

    leave: ( $el, $complete ) ->

        $complete()

这显然没什么帮助。

感觉好像它试图触发取消事件或某些不可用的东西而是获取一个对象。它让我感到困惑,因为我无法弄清楚这个错误似乎来自哪里。还有其他人有类似的问题吗?

干杯谢谢!

0 个答案:

没有答案