mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Button click support
This commit is contained in:
11
js/ext/angular/src/directive/ionicNavRouter.js
vendored
11
js/ext/angular/src/directive/ionicNavRouter.js
vendored
@ -167,11 +167,11 @@ angular.module('ionic.ui.navRouter', [])
|
||||
template: '<header class="bar bar-header nav-bar" ng-class="{hidden: !navController.navBar.isVisible}">' +
|
||||
'<div class="buttons"> ' +
|
||||
'<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>' +
|
||||
'<h1 class="title" ng-bind="currentTitle"></h1>' +
|
||||
'<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>' +
|
||||
'</header>',
|
||||
link: function($scope, $element, $attr, navCtrl) {
|
||||
@ -215,7 +215,10 @@ angular.module('ionic.ui.navRouter', [])
|
||||
|
||||
var oldTitle = $scope.currentTitle;
|
||||
$scope.oldTitle = oldTitle;
|
||||
$scope.currentTitle = data.title;
|
||||
|
||||
if(typeof data.title !== 'undefined') {
|
||||
$scope.currentTitle = data.title;
|
||||
}
|
||||
|
||||
if(typeof data.leftButtons !== 'undefined') {
|
||||
$scope.leftButtons = data.leftButtons;
|
||||
@ -227,7 +230,7 @@ angular.module('ionic.ui.navRouter', [])
|
||||
$scope.enableBackButton = data.hideBackButton !== true;
|
||||
}
|
||||
|
||||
if(data.animate !== false) {
|
||||
if(data.animate !== false && typeof data.title !== 'undefined') {
|
||||
animate($scope, $element, oldTitle, data, function() {
|
||||
hb.align();
|
||||
});
|
||||
|
||||
2
js/ext/angular/src/directive/ionicTabBar.js
vendored
2
js/ext/angular/src/directive/ionicTabBar.js
vendored
@ -138,7 +138,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate'])
|
||||
rightButtons: $scope.rightButtons,
|
||||
leftButtons: $scope.leftButtons,
|
||||
hideBackButton: $scope.hideBackButton || false,
|
||||
animate: $scope.animate || false
|
||||
animate: $scope.animate || true
|
||||
});
|
||||
}
|
||||
//$scope.$emit('navRouter.titleChanged', $scope.title);
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
</pane>
|
||||
|
||||
<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">
|
||||
|
||||
<!-- Pets tab -->
|
||||
@ -133,7 +133,13 @@
|
||||
|
||||
.controller('AdoptCtrl', function($scope) {
|
||||
$scope.buttons = [
|
||||
{ text: 'Adopt' }
|
||||
{
|
||||
text: 'Adopt',
|
||||
tap: function(e) {
|
||||
console.log('ADOPT TAPPED');
|
||||
},
|
||||
type: 'button-clear'
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user