mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
View pushes to nav
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import {Component, Template, Inject, Parent, NgElement} from 'angular2/angular2'
|
import {Component, Template, Inject, Parent, NgElement} from 'angular2/angular2'
|
||||||
import {ComponentConfig} from 'ionic2/config/component-config'
|
import {ComponentConfig} from 'ionic2/config/component-config'
|
||||||
|
import {Log} from 'ionic2/util'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ion-nav',
|
selector: 'ion-nav',
|
||||||
@ -24,11 +25,13 @@ export class NavView {
|
|||||||
* @param shouldAnimate whether to animate
|
* @param shouldAnimate whether to animate
|
||||||
*/
|
*/
|
||||||
push(view, shouldAnimate) {
|
push(view, shouldAnimate) {
|
||||||
this.views.push(view)
|
this._views.push(view)
|
||||||
|
|
||||||
if(shouldAnimate) {
|
if(shouldAnimate) {
|
||||||
this.animateIn(view)
|
this._animateIn(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.log('NAV: PUSH', view, 'Animate?', shouldAnimate)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,10 +40,10 @@ export class NavView {
|
|||||||
* @param shouldAnimate whether to animate
|
* @param shouldAnimate whether to animate
|
||||||
*/
|
*/
|
||||||
pop(shouldAnimate) {
|
pop(shouldAnimate) {
|
||||||
last = stack.pop()
|
last = this._views.pop()
|
||||||
|
|
||||||
if(shouldAnimate) {
|
if(shouldAnimate) {
|
||||||
this.animateOut(last)
|
this._animateOut(last)
|
||||||
}
|
}
|
||||||
|
|
||||||
return last
|
return last
|
||||||
@ -58,6 +61,7 @@ export class NavView {
|
|||||||
|
|
||||||
// Animate a new view *in*
|
// Animate a new view *in*
|
||||||
_animateIn(view) {
|
_animateIn(view) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Animate an old view *out*
|
// Animate an old view *out*
|
||||||
|
@ -24,5 +24,10 @@ export class View {
|
|||||||
constructor(@NgElement() ele:NgElement, @Parent() nav: NavView) {
|
constructor(@NgElement() ele:NgElement, @Parent() nav: NavView) {
|
||||||
ele.domElement.classList.add('pane')
|
ele.domElement.classList.add('pane')
|
||||||
console.log('View constructed', ele.domElement, nav);
|
console.log('View constructed', ele.domElement, nav);
|
||||||
|
|
||||||
|
// TODO: Figure out better way to do this
|
||||||
|
if(nav) {
|
||||||
|
nav.push(this, true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user