ionicView.enter未在子视图及其控制器上触发

Gre*_*dic 7 state ionic ionic-view

我有两个嵌套状态,由父抽象状态和子状态组成:

.state('app.heatingControllerDetails', {
                url: "/clients/:clientId/heatingControllers/:heatingControllerId",
                abstract: true,
                views: {
                    'menuContent': {
                        templateUrl: "templates/heatingController.html",
                        controller: 'HCDetailsCtrl'
                    }
                }
            })
.state('app.heatingControllerDetails.wdc', {
                url: "/wdc",
                views: {
                    'hc-details': {
                        templateUrl: "templates/heatingControllers/wdc.html",
                        controller: 'WdcDetailsCtrl'
                    }
                },
                resolve:{
                    hcFamily: [function(){
                        return 'wdc';
                    }]
                }
            })
Run Code Online (Sandbox Code Playgroud)

和两个控制器是:

   .controller('HCDetailsCtrl',function($scope){
        $scope.$on("$ionicView.enter", function (scopes, states) {
        ...
        });
     })
    .controller('WdcDetailsCtrl',function($scope){
        $scope.$on("$ionicView.enter", function (scopes, states) {
        ...
        });
     })
Run Code Online (Sandbox Code Playgroud)

当我调用状态app.heatingControllerDetails.wdc时,会创建两个控制器,但仅在父控制器上调用$ ionicView.enter.任何的想法?

在heatingController.html中,hc-details视图定义如下:

<ion-content class="has-header" ng-show="hc">
    <div ui-view name="hc-details"></div>
    <div class="disableContentDiv" ng-hide="hc.state=='Online'"></div>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

oli*_*ra1 0

使用嵌套视图时,必须使用$ionicNavView事件而不是$ionicView

话虽如此,在上一个版本中,这些事件出现了 bug,目前正在修复:Github 问题