Button click support

This commit is contained in:
Max Lynch
2013-11-19 15:51:04 -06:00
parent 2064126e5f
commit 4586516e0e
4 changed files with 24 additions and 12 deletions

View File

@ -25430,11 +25430,11 @@ angular.module('ionic.ui.navRouter', [])
template: '<header class="bar bar-header nav-bar" ng-class="{hidden: !navController.navBar.isVisible}">' + template: '<header class="bar bar-header nav-bar" ng-class="{hidden: !navController.navBar.isVisible}">' +
'<div class="buttons"> ' + '<div class="buttons"> ' +
'<button nav-back class="button" ng-if="enableBackButton && showBackButton" ng-class="backButtonType" ng-bind-html="backButtonContent"></button>' + '<button nav-back class="button" ng-if="enableBackButton && showBackButton" ng-class="backButtonType" ng-bind-html="backButtonContent"></button>' +
'<button ng-repeat="button in leftButtons" class="button" ng-bind="button.text"></button>' + '<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button {{button.type}}" ng-bind="button.text"></button>' +
'</div>' + '</div>' +
'<h1 class="title" ng-bind="currentTitle"></h1>' + '<h1 class="title" ng-bind="currentTitle"></h1>' +
'<div class="buttons"> ' + '<div class="buttons"> ' +
'<button ng-repeat="button in rightButtons" class="button" ng-bind="button.text"></button>' + '<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button {{button.type}}" ng-bind="button.text"></button>' +
'</div>' + '</div>' +
'</header>', '</header>',
link: function($scope, $element, $attr, navCtrl) { link: function($scope, $element, $attr, navCtrl) {
@ -25478,7 +25478,10 @@ angular.module('ionic.ui.navRouter', [])
var oldTitle = $scope.currentTitle; var oldTitle = $scope.currentTitle;
$scope.oldTitle = oldTitle; $scope.oldTitle = oldTitle;
$scope.currentTitle = data.title;
if(typeof data.title !== 'undefined') {
$scope.currentTitle = data.title;
}
if(typeof data.leftButtons !== 'undefined') { if(typeof data.leftButtons !== 'undefined') {
$scope.leftButtons = data.leftButtons; $scope.leftButtons = data.leftButtons;
@ -25490,7 +25493,7 @@ angular.module('ionic.ui.navRouter', [])
$scope.enableBackButton = data.hideBackButton !== true; $scope.enableBackButton = data.hideBackButton !== true;
} }
if(data.animate !== false) { if(data.animate !== false && typeof data.title !== 'undefined') {
animate($scope, $element, oldTitle, data, function() { animate($scope, $element, oldTitle, data, function() {
hb.align(); hb.align();
}); });
@ -26041,7 +26044,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate'])
rightButtons: $scope.rightButtons, rightButtons: $scope.rightButtons,
leftButtons: $scope.leftButtons, leftButtons: $scope.leftButtons,
hideBackButton: $scope.hideBackButton || false, hideBackButton: $scope.hideBackButton || false,
animate: $scope.animate || false animate: $scope.animate || true
}); });
} }
//$scope.$emit('navRouter.titleChanged', $scope.title); //$scope.$emit('navRouter.titleChanged', $scope.title);

View File

@ -167,11 +167,11 @@ angular.module('ionic.ui.navRouter', [])
template: '<header class="bar bar-header nav-bar" ng-class="{hidden: !navController.navBar.isVisible}">' + template: '<header class="bar bar-header nav-bar" ng-class="{hidden: !navController.navBar.isVisible}">' +
'<div class="buttons"> ' + '<div class="buttons"> ' +
'<button nav-back class="button" ng-if="enableBackButton && showBackButton" ng-class="backButtonType" ng-bind-html="backButtonContent"></button>' + '<button nav-back class="button" ng-if="enableBackButton && showBackButton" ng-class="backButtonType" ng-bind-html="backButtonContent"></button>' +
'<button ng-repeat="button in leftButtons" class="button" ng-bind="button.text"></button>' + '<button ng-click="button.tap($event)" ng-repeat="button in leftButtons" class="button {{button.type}}" ng-bind="button.text"></button>' +
'</div>' + '</div>' +
'<h1 class="title" ng-bind="currentTitle"></h1>' + '<h1 class="title" ng-bind="currentTitle"></h1>' +
'<div class="buttons"> ' + '<div class="buttons"> ' +
'<button ng-repeat="button in rightButtons" class="button" ng-bind="button.text"></button>' + '<button ng-click="button.tap($event)" ng-repeat="button in rightButtons" class="button {{button.type}}" ng-bind="button.text"></button>' +
'</div>' + '</div>' +
'</header>', '</header>',
link: function($scope, $element, $attr, navCtrl) { link: function($scope, $element, $attr, navCtrl) {
@ -215,7 +215,10 @@ angular.module('ionic.ui.navRouter', [])
var oldTitle = $scope.currentTitle; var oldTitle = $scope.currentTitle;
$scope.oldTitle = oldTitle; $scope.oldTitle = oldTitle;
$scope.currentTitle = data.title;
if(typeof data.title !== 'undefined') {
$scope.currentTitle = data.title;
}
if(typeof data.leftButtons !== 'undefined') { if(typeof data.leftButtons !== 'undefined') {
$scope.leftButtons = data.leftButtons; $scope.leftButtons = data.leftButtons;
@ -227,7 +230,7 @@ angular.module('ionic.ui.navRouter', [])
$scope.enableBackButton = data.hideBackButton !== true; $scope.enableBackButton = data.hideBackButton !== true;
} }
if(data.animate !== false) { if(data.animate !== false && typeof data.title !== 'undefined') {
animate($scope, $element, oldTitle, data, function() { animate($scope, $element, oldTitle, data, function() {
hb.align(); hb.align();
}); });

View File

@ -138,7 +138,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate'])
rightButtons: $scope.rightButtons, rightButtons: $scope.rightButtons,
leftButtons: $scope.leftButtons, leftButtons: $scope.leftButtons,
hideBackButton: $scope.hideBackButton || false, hideBackButton: $scope.hideBackButton || false,
animate: $scope.animate || false animate: $scope.animate || true
}); });
} }
//$scope.$emit('navRouter.titleChanged', $scope.title); //$scope.$emit('navRouter.titleChanged', $scope.title);

View File

@ -17,7 +17,7 @@
</pane> </pane>
<script id="page1.html" type="text/ng-template"> <script id="page1.html" type="text/ng-template">
<nav-page title="'Pets'" hide-back-button="true"> <nav-page hide-back-button="true">
<tabs tabs-style="tabs-icon-top" tabs-type="tabs-positive"> <tabs tabs-style="tabs-icon-top" tabs-type="tabs-positive">
<!-- Pets tab --> <!-- Pets tab -->
@ -133,7 +133,13 @@
.controller('AdoptCtrl', function($scope) { .controller('AdoptCtrl', function($scope) {
$scope.buttons = [ $scope.buttons = [
{ text: 'Adopt' } {
text: 'Adopt',
tap: function(e) {
console.log('ADOPT TAPPED');
},
type: 'button-clear'
}
]; ];
}); });