If you use angular and you do not use page in html, or you use lazy module loading, or you have several page-router-outlet , you use 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 HTML directive where you want to hide the action bar.
SecondPage.html
<GridLayout tkExampleTitle tkToggleNavButton rows="auto,*" hideActionBar> ...// other html goes here </GridLayout>
PS Remember to declare it in NgModule, as directives are declarative . This is very useful for code sharing projects, as you will declare it in ngmodule.tns.ts and it will not be compiled for a web project.
declarations: [ AppComponent, MyDirective ],
source share