mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(modal): align header title after viewable
This commit is contained in:
3
js/angular/directive/headerFooterBar.js
vendored
3
js/angular/directive/headerFooterBar.js
vendored
@@ -140,6 +140,9 @@ function headerFooterBarDirective(isHeader) {
|
||||
delete $scope.$hasSubheader;
|
||||
});
|
||||
ctrl.align();
|
||||
$scope.$on('$ionicHeader.align', function() {
|
||||
ctrl.align();
|
||||
});
|
||||
|
||||
} else {
|
||||
$scope.$watch(function() { return $element[0].className; }, function(value) {
|
||||
|
||||
23
js/angular/service/modal.js
vendored
23
js/angular/service/modal.js
vendored
@@ -18,7 +18,7 @@
|
||||
*
|
||||
* - This example assumes your modal is in your main index file or another template file. If it is in its own
|
||||
* template file, remove the script tags and call it by file name.
|
||||
*
|
||||
*
|
||||
* @usage
|
||||
* ```html
|
||||
* <script id="my-modal.html" type="text/ng-template">
|
||||
@@ -119,7 +119,7 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
|
||||
show: function(target) {
|
||||
var self = this;
|
||||
|
||||
if(self.scope.$$destroyed) {
|
||||
if (self.scope.$$destroyed) {
|
||||
$log.error('Cannot call ' + self.viewType + '.show() after remove(). Please create a new ' + self.viewType + ' instance.');
|
||||
return;
|
||||
}
|
||||
@@ -127,19 +127,19 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
|
||||
var modalEl = jqLite(self.modalEl);
|
||||
|
||||
self.el.classList.remove('hide');
|
||||
$timeout(function(){
|
||||
$timeout(function() {
|
||||
$ionicBody.addClass(self.viewType + '-open');
|
||||
}, 400);
|
||||
|
||||
if(!self.el.parentElement) {
|
||||
if (!self.el.parentElement) {
|
||||
modalEl.addClass(self.animation);
|
||||
$ionicBody.append(self.el);
|
||||
}
|
||||
|
||||
if(target && self.positionView) {
|
||||
if (target && self.positionView) {
|
||||
self.positionView(target, modalEl);
|
||||
// set up a listener for in case the window size changes
|
||||
ionic.on('resize',function(){
|
||||
ionic.on('resize',function() {
|
||||
ionic.off('resize',null,window);
|
||||
self.positionView(target,modalEl);
|
||||
},window);
|
||||
@@ -158,11 +158,12 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
|
||||
|
||||
ionic.views.Modal.prototype.show.call(self);
|
||||
|
||||
$timeout(function(){
|
||||
$timeout(function() {
|
||||
modalEl.addClass('ng-enter-active');
|
||||
ionic.trigger('resize');
|
||||
self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.shown', self);
|
||||
self.el.classList.add('active');
|
||||
self.scope.$broadcast('$ionicHeader.align');
|
||||
}, 20);
|
||||
|
||||
return $timeout(function() {
|
||||
@@ -188,7 +189,7 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
|
||||
self.el.classList.remove('active');
|
||||
modalEl.addClass('ng-leave');
|
||||
|
||||
$timeout(function(){
|
||||
$timeout(function() {
|
||||
modalEl.addClass('ng-leave-active')
|
||||
.removeClass('ng-enter ng-enter-active active');
|
||||
}, 20);
|
||||
@@ -201,11 +202,11 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
|
||||
ionic.views.Modal.prototype.hide.call(self);
|
||||
|
||||
// clean up event listeners
|
||||
if(self.positionView) {
|
||||
if (self.positionView) {
|
||||
ionic.off('resize',null,window);
|
||||
}
|
||||
|
||||
return $timeout(function(){
|
||||
return $timeout(function() {
|
||||
$ionicBody.removeClass(self.viewType + '-open');
|
||||
self.el.classList.add('hide');
|
||||
}, self.hideDelay || 320);
|
||||
@@ -264,7 +265,7 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
|
||||
|
||||
// If this wasn't a defined scope, we can assign the viewType to the isolated scope
|
||||
// we created
|
||||
if(!options.scope) {
|
||||
if (!options.scope) {
|
||||
scope[ options.viewType ] = modal;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user