Попробуйте сделать это для отложенной загрузки маршрутизации.
app-routing.module.ts: -
import { NgModule } from "@angular/core";
import { Routes } from "@angular/router";
import { NativeScriptRouterModule } from "nativescript-angular/router";
const routes: Routes = [
{ path: "", redirectTo: "/login", pathMatch: "full" },
{ path: "library", loadChildren: "~/pages/library/library.module#LibraryModule" },
{ path: "login", loadChildren: "~/pages/login/login.module#LoginModule" }
]
@NgModule({
imports: [NativeScriptRouterModule.forRoot(routes)],
exports: [NativeScriptRouterModule]
})
export class AppRoutingModule { }
Код перенаправления: -
import { NgZone } from "@angular/core";
import { isIOS } from "tns-core-modules/platform";
import { RouterExtensions } from "nativescript-angular/router";
constructor(private zone: NgZone,
private _routerExtensions: RouterExtensions){ }
gotoStartPage() {
setTimeout(() => {
this.zone.run(() => {
this._routerExtensions.navigate(["library"], {
clearHistory: (isIOS) ? true : false,
});
});
}, 500);
}