我喜欢根据视图隐藏和显示图标。这是我无法做到的,因为ion-nav-bar
只能从tabsCtrl
以下是查看标记:
<ion-nav-bar class="bar-stable">
<ion-nav-back-button> </ion-nav-back-button>
<ion-nav-title>My App Title</ion-nav-title>
<ion-nav-buttons side="right">
<button class="button icon ion-ios-information-outline" ng-click="openFaqModal()" ng-hide="showHideFAQ"></button>
<button class="button icon ci-bookmark" ng-click="openBoookmarkModal()" ng-show="showHideBookmark"></button>
</ion-nav-buttons>
</ion-nav-bar>
这是控制器:
// Tab Controller - *** This Work ***
.controller('TabCtrl', function ($scope) {
$rootScope.showHideFAQ = true;
$rootScope.showHideBookmark = true;
})
// Detail Controller - *** This do not work ***
.controller('DetailCtrl', function ($scope) {
$rootScope.showHideFAQ = true;
$rootScope.showHideBookmark = true;
})
这是路线:
// setup an abstract state for the tabs directive
.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'views/tabs.html',
controller: 'TabCtrl'
})
.state('tab.detail', {
url: '/resources/:resourcesId',
views: {
'tab-resources': {
templateUrl: 'views/detail.html',
controller: 'DetailCtrl'
}
}
})
我不知道为什么它会在&#34; TabCtrl&#34;但不是在&#34; DetailCtrl&#34;因为两个控制器都加载在一个视图中。我怀疑它与scope
有关。
答案 0 :(得分:0)
我正在使用$ionicView.leave
和// Detail Controller
.controller('DetailCtrl', function ($scope, $ionicView) {
// Show Bookmark and Hide FAQ icon
$scope.$on('$ionicView.enter', function() {
$rootScope.showHideFAQ = true;
$rootScope.showHideBookmark = true;
});
// Hide Bookmark and Show FAQ icon
$scope.$on('$ionicView.leave', function() {
$rootScope.showHideFAQ = false;
$rootScope.showHideBookmark = false;
});
})
来解决我的问题:
pandas.DataFrame.plot()