如何在Nativescript Angular中设置默认的起始页面

时间:2018-07-21 10:20:32

标签: angular nativescript nativescript-angular

我使用ipconfig构建了一个本机脚本项目, 它使用tns create appname --template ng,nativescript文档说,最新的组件是启动的组件,我有要首先启动的页面,反正还有吗?

1 个答案:

答案 0 :(得分:1)

您应该尝试将默认路由更改为app.routing.ts中的所需组件

例如:

尝试更改以下代码

const routes: Routes = [
    { path: "", redirectTo: "/items", pathMatch: "full" },
    { path: "items", component: ItemsComponent },
    { path: "item/:id", component: ItemDetailComponent },
];

收件人

const routes: Routes = [
    { path: "", redirectTo: "/yourcomponent", pathMatch: "full" },
    { path: "items", component: ItemsComponent },
    { path: "item/:id", component: ItemDetailComponent },
    { path: "yourcomponent", component: YourComponent },

];