Skip to content

Commit

Permalink
fix(router): Fix component declaration and redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Ostap Chervak committed Jan 3, 2018
1 parent 7fe3ddd commit 1c780ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/simple-ts/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
];
4 changes: 2 additions & 2 deletions src/router-lib/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface Navigation {

export interface RouteConfig {
path: string;
component: any;
component?: any;
query?: Array<string>;
key?: string;
children?: RouteConfig[];
Expand Down Expand Up @@ -132,7 +132,7 @@ export async function bootRouter(config: PoaBootConfig): Promise<BootedRouter> {
];

overridingHooks.forEach(hook => {
if (route.component[hook]) {
if (route.component && route.component[hook]) {
route[hook] = route.component[hook];
}
});
Expand Down

0 comments on commit 1c780ed

Please sign in to comment.