diff --git a/examples/simple-ts/routes.ts b/examples/simple-ts/routes.ts index 9c00cbd..c4d51b2 100644 --- a/examples/simple-ts/routes.ts +++ b/examples/simple-ts/routes.ts @@ -4,7 +4,8 @@ import { UsersPage } from './pages/users.page'; import { AboutPage } from './pages/about.page'; export const routes = [ - { path: '', component: RootPage }, + { path: '', redirectTo: '/home' }, + { path: '/home', component: RootPage }, { path: '/users', component: UsersPage }, { path: '/about', component: AboutPage } ]; diff --git a/src/router-lib/router.ts b/src/router-lib/router.ts index 32318e2..92176ac 100644 --- a/src/router-lib/router.ts +++ b/src/router-lib/router.ts @@ -42,7 +42,7 @@ export interface Navigation { export interface RouteConfig { path: string; - component: any; + component?: any; query?: Array; key?: string; children?: RouteConfig[]; @@ -132,7 +132,7 @@ export async function bootRouter(config: PoaBootConfig): Promise { ]; overridingHooks.forEach(hook => { - if (route.component[hook]) { + if (route.component && route.component[hook]) { route[hook] = route.component[hook]; } });