简体   繁体   中英

Why is ActionBar not appearing? Nativescript/Angular2

Why is my ActionBar not appearing on my /home page, when it's working on my /login page?

login.component.html

<ActionBar title="Application Title"></ActionBar>

home.component.html

<ActionBar title="Application Title"></ActionBar>

No error is thrown when this occurs.

Make sure that if you're creating a submodule within the NativeScript/Angular2 application that you add this to your submodule's import statement:

import {NativeScriptModule} from "nativescript-angular/nativescript.module";

In my case, home.component.ts and home.component.html was part of a submodule called home.module.ts .

import {NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
import {HomeComponent} from "./home.component";
import {HomeRoutingModule} from "./home-routing.module";
import {NativeScriptModule} from "nativescript-angular/nativescript.module";

@NgModule({
    imports: [
        HomeRoutingModule,
        NativeScriptModule //<-- this is needed
    ],
    declarations: [
        HomeComponent
    ],
    schemas: [
        NO_ERRORS_SCHEMA
    ]
})
export class HomeModule {

}

github nativescript issue #450

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM