Reputation: 12885
link: https://play.nativescript.org/?template=play-ng&id=Annyna&v=4
error: ERROR Error: Uncaught (in promise): Error: com.tns.NativeScriptException: Failed to find module: "./TrainingUnit", relative to: app/trainingunit/list/
Its odd that the module name in the error message is: "./TrainingUnit"
The module file name is: trainingunit.module
The module class name is: TrainingUnitModule
Both module "names" seem correct.
As I assume there error is in the AppRouterModule:
import { NgModule } from "@angular/core";
import { Routes } from "@angular/router";
import { NativeScriptRouterModule } from "nativescript-angular/router";
const routes: Routes = [
{ path: "", redirectTo: "/trainingunits", pathMatch: "full" },
{ path: "trainingunits", loadChildren: "./trainingunit/list/trainingunit.module#TrainingUnitModule" }
];
@NgModule({
imports: [NativeScriptRouterModule.forRoot(routes)],
exports: [NativeScriptRouterModule]
})
export class AppRoutingModule { }
Upvotes: 2
Views: 43
Reputation: 14221
In the TrainingUnitComponent you are trying to import TrainingUnit
from ./TrainingUnit
but the file name should should be ./trainingunit
. Update to import the class from the correct file and you should be good to go.
import TrainingUnit from "./trainingunit";
Upvotes: 1