I am new to Angular2 routing. I have a use case where the Home page simply has a login dialog. There are no navigational elements on this page. When the user successfully logs in, they should land on the Main page that has tabs to navigate to other pages of the app. How can I configure the router for this use case?
Edit
To clarify, this is the page structure for my use case:
Home (Login) (/)
/ | \
Page1 Page2 Page3
(/page1) (/page2) (/page3)
The Home page has no navigation. The only way to navigate out of the Home page is to successfully log in. This should take you to Page1. Pages 1, 2 & 3 show a tab bar at the top to navigate between them.
I looked at the example in the Angular2 docs. There the app starts at the Page1, Page2 level directly. The navbar is visible as soon as the app comes up. It is housed at the app level, in app.component.ts.
So my question is: how do I achieve the page structure shown above? How would the code and components be structured to achieve this? I am guessing that the app component will be blank with just a router outlet, with the path / taking me to the home page:
@Component({
template: `
<router-outlet></router-outlet>
`,
directives: [RouterOutlet]
})
@RouteConfig([
{path:'/', name: 'Home', component: HomeComponent, useAsDefault: true},
{path:'/page1', name: 'Page1', component: Page1Component},
{path:'/page2', name: 'Page2', component: Page2Component},
{path:'/page3', name: 'Page3', component: Page3Component}
])
Routes /page1, /page2 etc. take me to authenticated pages. Each one of these pages would include a common navbar component. Does this approach look good?
router.navigate();?