mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
Fixed #254
This commit is contained in:
12
dist/js/ionic-angular.js
vendored
12
dist/js/ionic-angular.js
vendored
@@ -1311,6 +1311,13 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
|
||||
}
|
||||
});
|
||||
|
||||
// If a nav page changes the left or right buttons, update our scope vars
|
||||
$scope.$parent.$on('navRouter.leftButtonsChanged', function(e, data) {
|
||||
$scope.leftButtons = data;
|
||||
});
|
||||
$scope.$parent.$on('navRouter.rightButtonsChanged', function(e, data) {
|
||||
$scope.rightButtons = data;
|
||||
});
|
||||
|
||||
/*
|
||||
$scope.$parent.$on('navigation.push', function() {
|
||||
@@ -1361,7 +1368,7 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
|
||||
$scope.$watch(leftButtonsGet, function(value) {
|
||||
$scope.leftButtons = value;
|
||||
if($scope.doesUpdateNavRouter) {
|
||||
$scope.$emit('navRouter.leftButtonsChanged', $scope.rightButtons);
|
||||
$scope.$emit('navRouter.leftButtonsChanged', $scope.leftButtons);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1369,6 +1376,9 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
|
||||
var rightButtonsGet = $parse($attr.rightButtons);
|
||||
$scope.$watch(rightButtonsGet, function(value) {
|
||||
$scope.rightButtons = value;
|
||||
if($scope.doesUpdateNavRouter) {
|
||||
$scope.$emit('navRouter.rightButtonsChanged', $scope.rightButtons);
|
||||
}
|
||||
});
|
||||
|
||||
// watch for changes in the title
|
||||
|
||||
12
js/ext/angular/src/directive/ionicNavRouter.js
vendored
12
js/ext/angular/src/directive/ionicNavRouter.js
vendored
@@ -283,6 +283,13 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
|
||||
}
|
||||
});
|
||||
|
||||
// If a nav page changes the left or right buttons, update our scope vars
|
||||
$scope.$parent.$on('navRouter.leftButtonsChanged', function(e, data) {
|
||||
$scope.leftButtons = data;
|
||||
});
|
||||
$scope.$parent.$on('navRouter.rightButtonsChanged', function(e, data) {
|
||||
$scope.rightButtons = data;
|
||||
});
|
||||
|
||||
/*
|
||||
$scope.$parent.$on('navigation.push', function() {
|
||||
@@ -333,7 +340,7 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
|
||||
$scope.$watch(leftButtonsGet, function(value) {
|
||||
$scope.leftButtons = value;
|
||||
if($scope.doesUpdateNavRouter) {
|
||||
$scope.$emit('navRouter.leftButtonsChanged', $scope.rightButtons);
|
||||
$scope.$emit('navRouter.leftButtonsChanged', $scope.leftButtons);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -341,6 +348,9 @@ angular.module('ionic.ui.navRouter', ['ionic.service.gesture'])
|
||||
var rightButtonsGet = $parse($attr.rightButtons);
|
||||
$scope.$watch(rightButtonsGet, function(value) {
|
||||
$scope.rightButtons = value;
|
||||
if($scope.doesUpdateNavRouter) {
|
||||
$scope.$emit('navRouter.rightButtonsChanged', $scope.rightButtons);
|
||||
}
|
||||
});
|
||||
|
||||
// watch for changes in the title
|
||||
|
||||
@@ -31,7 +31,15 @@
|
||||
$scope.headerTitle = 'A really really really really really long title here';
|
||||
$scope.leftButtons = [
|
||||
{
|
||||
text: 'Hello',
|
||||
content: 'Hello',
|
||||
click: function(e) {
|
||||
console.log('Click button');
|
||||
}
|
||||
}
|
||||
]
|
||||
$scope.rightButtons = [
|
||||
{
|
||||
content: 'Hello',
|
||||
click: function(e) {
|
||||
console.log('Click button');
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</tab>
|
||||
|
||||
<!-- Adoption tab -->
|
||||
<tab title="Adopt" icon="icon ion-heart" ng-controller="AdoptCtrl" right-buttons="buttons">
|
||||
<tab title="Adopt" icon="icon ion-heart" ng-controller="AdoptCtrl" left-buttons="leftButtons" right-buttons="buttons">
|
||||
<content has-header="true" has-tabs="true">
|
||||
<div class="padding">
|
||||
<h2>Adopt a pet today.</h2>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</pane>
|
||||
|
||||
<script id="page1.html" type="text/ng-template">
|
||||
<nav-page title="'Bears'" hide-back-button="true">
|
||||
<nav-page title="'Bears'" hide-back-button="true" right-buttons="rightButtons">
|
||||
<content has-header="true">
|
||||
<h1>Page 1</h1>
|
||||
<span>{{num}}</span>
|
||||
@@ -76,6 +76,15 @@
|
||||
|
||||
.controller('Page1Ctrl', function($scope) {
|
||||
$scope.num = Math.floor(Math.random() * 100);
|
||||
|
||||
$scope.rightButtons = [
|
||||
{
|
||||
text: 'Hello',
|
||||
click: function(e) {
|
||||
console.log('Click button');
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user