-
-
Save Yogatopia/501fb8a2e79d553689c885d8cd62fd8a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Directive } from '@angular/core'; | |
import { ViewController } from 'ionic-angular'; | |
@Directive({ | |
selector: '[hideTabs]' | |
}) | |
export class HideTabsDirective { | |
constructor(private viewCtrl: ViewController) { | |
// hide tabs when view loads | |
this.viewCtrl.didEnter.subscribe(() => { | |
let tabs = document.querySelectorAll('.tabbar'); | |
if ( tabs !== null ) { | |
Object.keys(tabs).map((key) => { | |
tabs[ key ].style.transform = 'translateY(56px)'; | |
}); | |
} // end if | |
}); | |
// show tabs when view exits | |
this.viewCtrl.willLeave.subscribe(() => { | |
let tabs = document.querySelectorAll('.tabbar'); | |
if ( tabs !== null ) { | |
Object.keys(tabs).map((key) => { | |
tabs[ key ].style.transform = 'translateY(0)'; | |
}); | |
} // end if | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment