如何在 nativescript 中设置默认起始页 Angular

How to set a default starting page in nativescript Angular

我用 tns create appname --template ng 构建了一个 nativescript 项目, 它使用 page-router-outlet,nativescript 文档说最新的组件是启动的,我有我想首先启动的页面,有没有关于这个的?

您应该尝试在 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 },

];