mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 15:51:16 +08:00
Header bar tweaks
This commit is contained in:
35
js/ext/angular/src/directive/ionicHeader.js
vendored
35
js/ext/angular/src/directive/ionicHeader.js
vendored
@ -9,11 +9,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],
|
||||
@ -24,6 +39,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() {
|
||||
//
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user