If you are using angular and you don't use page
in your html or you are using lazy loading of modules or you have multiple page-router-outlet
, you take advantage of directives.
Create a new directive:
hideActionBar.ts
import { Directive } from '@angular/core';
import { Page } from 'tns-core-modules/ui/page/page';
@Directive({
selector: '[hideActionBar]'
})
export class HideActionBarDirective {
constructor(private page: Page) {
this.page.actionBarHidden = true;
}
}
and use this directive for the html where you want to hide the actionbar.
SecondPage.html
<GridLayout tkExampleTitle tkToggleNavButton rows="auto,*" hideActionBar>
...// other html goes here
</GridLayout>
P.S. Don't forget to declare it in NgModule as directives are declarables. This is very useful for code sharing projects as you will be declaring it in ngmodule.tns.ts and it will not be compiled for web project.
declarations: [
AppComponent,
MyDirective
],