fix view hideNavBar attribute, closes #394

This commit is contained in:
Adam Bradley
2014-01-12 13:41:00 -06:00
parent 71e1f98f19
commit ff310600d9
5 changed files with 57 additions and 19 deletions

View File

@@ -2508,7 +2508,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
backButtonIcon: '@',
alignTitle: '@'
},
template: '<header class="bar bar-header nav-bar">'+//' ng-class="{invisible: !navController.navBar.isVisible}">' +
template: '<header class="bar bar-header nav-bar" ng-class="{invisible: !showNavBar}">' +
'<div class="buttons"> ' +
'<button view-back class="button" ng-if="enableBackButton" ng-class="backButtonClass" ng-bind-html="backButtonLabel"></button>' +
'<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
@@ -2518,7 +2518,7 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
'<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
'</div>' +
'</header>',
link: function($scope, $element, $attr, navCtrl) {
link: function($scope, $element, $attr) {
// Create the back button content and show/hide it based on scope settings
$scope.enableBackButton = true;
@@ -2527,8 +2527,10 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
$scope.backButtonClass += ' icon ' + $attr.backButtonIcon;
}
// Store a reference to our nav controller
$scope.navController = navCtrl;
$scope.showNavBar = true;
$rootScope.$on('viewState.showNavBar', function(e, data) {
$scope.showNavBar = data;
});
// Initialize our header bar view which will handle resizing and aligning our title labels
var hb = new ionic.views.HeaderBar({
@@ -2619,7 +2621,9 @@ angular.module('ionic.ui.viewState', ['ionic.service.view', 'ionic.service.gestu
$rootScope.$broadcast('viewState.showBackButton', false);
}
// Should the nav bar be hidden for this view or not?
$scope.hideNavBar = $scope.$eval($scope.hideNavBar);
$rootScope.$broadcast('viewState.showNavBar', !$scope.hideNavBar);
// watch for changes in the left buttons
$scope.$watch('leftButtons', function(value) {