How to Redirect to a certain route based on condition in Angular 2. : <p>I am creating one angular2-meteor app. </p>

<pre><code>export const routes: Route[] = [{
    path: '',
    redirectTo: "login",
    pathMatch: "full"
}, 
{
    path: 'login',
    component: LoginComponent
}, 
{
    path: 'csvtemplate',
    component: TemplateComponent,
    canActivate: ['canActivateForLoggedIn'],
    children: [{
        path: '',
        redirectTo: 'dashboard' &lt;----how to add condition for multiple path
    }, 
    {
        path:'dashboard',
        component: DashboardComponent
    },
    {
        path: 'csvtimeline/:month/:year',
        component: CsvTimelineComponent
    }, {
        path: 'csvjson',
        component: CsvJsonComponent
    }]
}];
</code></pre>

<p>When i login to my app using LoginComponent it will go to TemplateComponent which have three child components </p>

<ul>
<li>dashboard</li>
<li>csvtimeline</li>
<li>csvjson</li>
</ul>

<p>Now i have by default set redirectTo to my dashboard component. but in place of this redirect i want to redirect to csvjson component or csvtimeline component based on login user profile.</p>

<p>Suppose</p>

<p><strong>If Login User is "Admin" he should be redirectTo - > dashboard Component</strong></p>

<p><strong>If Login User is "Guest" then he should be redirectTo - > csvjson component</strong> </p>

<p>i know we can do this in ngOnInit() of dashboard component for redirect.</p>

<pre><code>if (this.user &amp;&amp; this.user.profile.role == 'Guest') {
             this._router.navigate(['csvtemplate/csvjson']);
        }
</code></pre>

<p>but i am looking for better option so i don't have to open dashboard component each time and it will directly go to csvjson component.</p>
