mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Header bar tweaks
This commit is contained in:
40
dist/js/ionic-angular.js
vendored
40
dist/js/ionic-angular.js
vendored
@ -27,6 +27,11 @@ angular.module('ionic.ui', [
|
||||
angular.module('ionic', [
|
||||
'ionic.service',
|
||||
'ionic.ui',
|
||||
|
||||
// Angular deps
|
||||
'ngAnimate',
|
||||
'ngTouch',
|
||||
'ngSanitize'
|
||||
]);
|
||||
;
|
||||
angular.module('ionic.service.actionSheet', ['ionic.service.templateLoad', 'ionic.ui.actionSheet', 'ngAnimate'])
|
||||
@ -637,11 +642,26 @@ angular.module('ionic.ui.header', ['ngAnimate'])
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
template: '<header class="bar bar-header" ng-transclude></header>',
|
||||
template: '<header class="bar bar-header">\
|
||||
<div class="buttons">\
|
||||
<button ng-repeat="button in leftButtons" class="button" ng-class="button.type" ng-click="button.click($event, $index)" ng-bind-html="button.content">\
|
||||
</button>\
|
||||
</div>\
|
||||
<h1 class="title" ng-bind="title"></h1>\
|
||||
<div class="buttons">\
|
||||
<button ng-repeat="button in rightButtons" class="button" ng-class="button.type" ng-click="button.click($event, $index)" ng-bind-html="button.content">\
|
||||
</button>\
|
||||
</div>\
|
||||
</header>',
|
||||
|
||||
scope: {
|
||||
leftButtons: '=',
|
||||
rightButtons: '=',
|
||||
title: '=',
|
||||
type: '@',
|
||||
alignTitle: '@',
|
||||
alignTitle: '@'
|
||||
},
|
||||
|
||||
link: function($scope, $element, $attr) {
|
||||
var hb = new ionic.views.HeaderBar({
|
||||
el: $element[0],
|
||||
@ -652,6 +672,22 @@ angular.module('ionic.ui.header', ['ngAnimate'])
|
||||
|
||||
$scope.headerBarView = hb;
|
||||
|
||||
$scope.$watch('leftButtons', function(val) {
|
||||
// Resize the title since the buttons have changed
|
||||
hb.align();
|
||||
});
|
||||
|
||||
$scope.$watch('rightButtons', function(val) {
|
||||
// Resize the title since the buttons have changed
|
||||
hb.align();
|
||||
});
|
||||
|
||||
$scope.$watch('title', function(val) {
|
||||
// Resize the title since the title has changed
|
||||
console.log('Title changed');
|
||||
hb.align();
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
//
|
||||
});
|
||||
|
||||
1
dist/js/ionic.js
vendored
1
dist/js/ionic.js
vendored
@ -2943,7 +2943,6 @@ window.ionic = {
|
||||
title.style.left = margin + 'px';
|
||||
title.style.right = margin + 'px';
|
||||
|
||||
console.log(title.offsetWidth, title.scrollWidth);
|
||||
if(title.offsetWidth < title.scrollWidth) {
|
||||
title.style.textAlign = 'left';
|
||||
title.style.right = (rightWidth + 5) + 'px';
|
||||
|
||||
Reference in New Issue
Block a user