为什么 ActionBar 没有出现? Nativescript/Angular2

Why is ActionBar not appearing? Nativescript/Angular2

为什么我的 ActionBar 在我的 /login 页面上运行时没有出现在我的 /home 页面上?

login.component.html

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

home.component.html

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

发生这种情况时不会抛出任何错误。

如果您在 NativeScript/Angular2 应用程序中创建子模块,请确保将其添加到子模块的导入语句中:

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

在我的例子中,home.component.tshome.component.html 是名为 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