Hi Developer,

Here is my sample code:

@RouteConfig([
    { path: '/Home/...', name: 'Home', component: HomeComponent,useAsDefault: 
true },
    { path: '/About/...', name: 'About', component: AboutComponent },
    { path: '/Product/...', name: 'Product', component: ProductComponent },
    { path: '/Contact/...', name: 'Contact', component: ContactComponent }
])

<div *ngIf="isLoggedIn()">
    <nav>
        <a *ngIf="roleName === 'User'" [routerLink]="['Home']">Home</a>
        <a *ngIf="roleName === 'User'" [routerLink]="['About']">About</a>
        <a *ngIf="roleName === 'Admin'" [routerLink]="['Product']">Product</a>
        <a *ngIf="roleName === 'User'" [routerLink]="['Contact']">Contact</a>
    </nav>
</div>
<router-outlet></router-outlet>

 isLoggedIn() {
   this.userName = localStorage.getItem('current_user'); // Admin Username
   this.roleName = localStorage.getItem('current_role'); // Admin Role Name

    .......
    .......
 }


If admin is logged then how to direct page to Product as default page?
I am waiting for your response
Thanks in advance!




-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to