mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
ngZone.runOutsideAngular navbar title
This commit is contained in:
@@ -2,6 +2,7 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotatio
|
||||
import {View} from 'angular2/src/core/annotations_impl/view';
|
||||
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
|
||||
import {ProtoViewRef} from 'angular2/src/core/compiler/view_ref';
|
||||
import {NgZone} from 'angular2/src/core/zone/ng_zone';
|
||||
|
||||
import * as dom from '../../util/dom';
|
||||
import {Platform} from 'ionic/platform/platform';
|
||||
@@ -32,13 +33,14 @@ import {BackButton} from './back-button';
|
||||
directives: [BackButton]
|
||||
})
|
||||
export class Navbar {
|
||||
constructor(navItem: NavItem, elementRef: ElementRef) {
|
||||
constructor(navItem:NavItem, elementRef:ElementRef, ngZone:NgZone) {
|
||||
this.navItem = navItem;
|
||||
this.domElement = elementRef.domElement;
|
||||
|
||||
// http://davidwalsh.name/detect-node-insertion
|
||||
dom.animationStart(this.domElement, 'nodeInserted').then(() => {
|
||||
this.alignTitle();
|
||||
ngZone.runOutsideAngular(() => {
|
||||
setTimeout(() => {
|
||||
this.alignTitle();
|
||||
}, 32);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -104,9 +104,6 @@ export class NavBase {
|
||||
|
||||
opts.isAnimated = opts.animation !== 'none';
|
||||
|
||||
// block possible clicks during transition
|
||||
ClickBlock(opts.isAnimated, 520);
|
||||
|
||||
this.transitionStart(opts);
|
||||
|
||||
// wait for the new item to complete setup
|
||||
@@ -175,9 +172,6 @@ export class NavBase {
|
||||
let enteringItem = this.getPrevious(leavingItem);
|
||||
enteringItem.shouldDestroy = false;
|
||||
|
||||
// block possible clicks during transition
|
||||
ClickBlock(true);
|
||||
|
||||
// start the transition
|
||||
this.transitionStart({ isAnimated: true });
|
||||
|
||||
@@ -265,6 +259,8 @@ export class NavBase {
|
||||
|
||||
transitionStart(opts) {
|
||||
if (opts.isAnimated) {
|
||||
// block possible clicks during transition
|
||||
ClickBlock(true, 520);
|
||||
this.getNavElement().classList.add('transitioning');
|
||||
}
|
||||
}
|
||||
@@ -290,7 +286,7 @@ export class NavBase {
|
||||
}
|
||||
|
||||
isTransitioning() {
|
||||
var state;
|
||||
let state;
|
||||
for (let i = 0, ii = this.items.length; i < ii; i++) {
|
||||
state = this.items[i].state;
|
||||
if (state === ACTIVELY_ENTERING_STATE ||
|
||||
|
||||
Reference in New Issue
Block a user