在离子状态下禁用特定视图/状态的动画

时间:2016-08-25 15:29:04

标签: ionic-framework

我添加了一个自定义"输入/输出"动画状态称为"浏览器" Native Page Transitions在我的控制器中使用这个

$scope.$on('$ionicView.beforeEnter', function() {

        // animate things on devices
        window.plugins.nativepagetransitions.slide(
          {"direction":"up"},
                function (msg) { // called when the animation has finished
                    console.log("success: " + msg);
                },
                function (msg) {
                    alert("error: " + msg);
                }
        );
    });

$scope.$on('$ionicView.beforeLeave', function() {

        // animate things on devices
        window.plugins.nativepagetransitions.slide(
          {"direction":"down"},
                function (msg) { // called when the animation has finished
                    console.log("success: " + msg);
                },
                function (msg) {
                    alert("error: " + msg);
                }
        );
    });

它有效......有点儿。默认过渡(向左/向右滑动)仍然适用于我的"向上滑动"动画一种"在对角线上滑动的感觉。

有没有办法阻止被触发的默认转换?

这是我的观点

<ion-view >
<ion-nav-bar animation="no-animation">
</ion-nav-bar>

<ion-nav-view animation="no-animation"></ion-nav-view>


<ion-nav-buttons>

        <span class="ion-android-close close_browser" ng-click="goBack()"></span>

</ion-nav-buttons>

<ion-nav-title>
    <img src="img/logo_header.png">
</ion-nav-title>

<ion-content>


    <iframe class="browser" src="{{externalURL}}"></iframe>


</ion-content>

那些animation="no-animation"无效...

离子:1.1.1

1 个答案:

答案 0 :(得分:0)

解决方案是将其放在$state.go()

之前
$ionicHistory.nextViewOptions({
    disableAnimate: true
});