@@ -1168,11 +1168,11 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
11681168 template : '<header class="bar bar-header nav-bar" ng-class="{invisible: !navController.navBar.isVisible}">' +
11691169 '<div class="buttons"> ' +
11701170 '<button nav-back class="button" ng-if="enableBackButton && showBackButton" ng-class="backButtonClass" ng-bind-html="backButtonLabel"></button>' +
1171- '<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button {{button.type}}" ng-bind-html="button.content"></button>' +
1171+ '<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
11721172 '</div>' +
11731173 '<h1 class="title" ng-bind="currentTitle"></h1>' +
11741174 '<div class="buttons" ng-if="rightButtons.length"> ' +
1175- '<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button {{button.type}}" ng-bind-html="button.content"></button>' +
1175+ '<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button no-animation {{button.type}}" ng-bind-html="button.content"></button>' +
11761176 '</div>' +
11771177 '</header>' ,
11781178 link : function ( $scope , $element , $attr , navCtrl ) {
@@ -1234,6 +1234,14 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
12341234 }
12351235 } ;
12361236
1237+ $scope . $parent . $on ( 'navRouter.showBackButton' , function ( e , data ) {
1238+ $scope . enableBackButton = true ;
1239+ } ) ;
1240+
1241+ $scope . $parent . $on ( 'navRouter.hideBackButton' , function ( e , data ) {
1242+ $scope . enableBackButton = false ;
1243+ } ) ;
1244+
12371245 // Listen for changes on title change, and update the title
12381246 $scope . $parent . $on ( 'navRouter.pageChanged' , function ( e , data ) {
12391247 updateHeaderData ( data ) ;
@@ -1289,57 +1297,67 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
12891297. directive ( 'navPage' , [ '$parse' , function ( $parse ) {
12901298 return {
12911299 restrict : 'E' ,
1292- scope : true ,
12931300 require : '^navRouter' ,
1301+ scope : {
1302+ leftButtons : '=' ,
1303+ rightButtons : '=' ,
1304+ title : '=' ,
1305+ icon : '@' ,
1306+ iconOn : '@' ,
1307+ iconOff : '@' ,
1308+ type : '@' ,
1309+ alignTitle : '@' ,
1310+ hideBackButton : '@' ,
1311+ hideNavBar : '@' ,
1312+ animate : '@' ,
1313+ } ,
12941314 link : function ( $scope , $element , $attr , navCtrl ) {
12951315 $element . addClass ( 'pane' ) ;
12961316
1297- $scope . icon = $attr . icon ;
1298- $scope . iconOn = $attr . iconOn ;
1299- $scope . iconOff = $attr . iconOff ;
1300-
13011317 // Should we hide a back button when this tab is shown
1302- $scope . hideBackButton = $scope . $eval ( $attr . hideBackButton ) ;
1318+ $scope . hideBackButton = $scope . $eval ( $scope . hideBackButton ) ;
13031319
1304- $scope . hideNavBar = $scope . $eval ( $attr . hideNavBar ) ;
1320+ $scope . hideNavBar = $scope . $eval ( $scope . hideNavBar ) ;
13051321
13061322 navCtrl . navBar . isVisible = ! $scope . hideNavBar ;
13071323
1324+ if ( $scope . hideBackButton === true ) {
1325+ $scope . $emit ( 'navRouter.hideBackButton' ) ;
1326+ } else {
1327+ $scope . $emit ( 'navRouter.showBackButton' ) ;
1328+ }
1329+
13081330 // Whether we should animate on tab change, also impacts whether we
13091331 // tell any parent nav controller to animate
1310- $scope . animate = $scope . $eval ( $attr . animate ) ;
1311-
1312- // Grab whether we should update any parent nav router on tab changes
1313- $scope . doesUpdateNavRouter = $scope . $eval ( $attr . doesUpdateNavRouter ) || true ;
1332+ $scope . animate = $scope . $eval ( $scope . animate ) ;
1333+
13141334
13151335 // watch for changes in the left buttons
1316- var leftButtonsGet = $parse ( $attr . leftButtons ) ;
1317- $scope . $watch ( leftButtonsGet , function ( value ) {
1318- $scope . leftButtons = value ;
1319- if ( $scope . doesUpdateNavRouter ) {
1320- $scope . $emit ( 'navRouter.leftButtonsChanged' , $scope . leftButtons ) ;
1321- }
1336+ $scope . $watch ( 'leftButtons' , function ( value ) {
1337+ $scope . $emit ( 'navRouter.leftButtonsChanged' , $scope . leftButtons ) ;
13221338 } ) ;
13231339
1324- // watch for changes in the right buttons
1325- var rightButtonsGet = $parse ( $attr . rightButtons ) ;
1326- $scope . $watch ( rightButtonsGet , function ( value ) {
1327- $scope . rightButtons = value ;
1328- if ( $scope . doesUpdateNavRouter ) {
1329- $scope . $emit ( 'navRouter.rightButtonsChanged' , $scope . rightButtons ) ;
1340+ $scope . $watch ( 'rightButtons' , function ( val ) {
1341+ $scope . $emit ( 'navRouter.rightButtonsChanged' , $scope . rightButtons ) ;
1342+ } ) ;
1343+
1344+ /*
1345+ $scope.$watch('hideBackButton', function(value) {
1346+ if(value === true) {
1347+ navCtrl.hideBackButton();
1348+ } else {
1349+ navCtrl.showBackButton();
13301350 }
13311351 });
1352+ */
13321353
13331354 // watch for changes in the title
1334- var titleGet = $parse ( $attr . title ) ;
1335- $scope . $watch ( titleGet , function ( value ) {
1336- $scope . title = value ;
1355+ $scope . $watch ( 'title' , function ( value ) {
13371356 $scope . $emit ( 'navRouter.titleChanged' , {
13381357 title : value ,
13391358 animate : $scope . animate
13401359 } ) ;
13411360 } ) ;
1342-
13431361 }
13441362 } ;
13451363} ] )
0 commit comments