Skip to content

Instantly share code, notes, and snippets.

@Yogatopia
Forked from MT--/hide-tabs.directive.ts
Created September 7, 2017 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yogatopia/501fb8a2e79d553689c885d8cd62fd8a to your computer and use it in GitHub Desktop.
Save Yogatopia/501fb8a2e79d553689c885d8cd62fd8a to your computer and use it in GitHub Desktop.
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