title: How to get local storage data and set to default redirecto route in angular 7?
body: <pre><code>    import { NgModule, OnInit } from '@angular/core';
      import { RouterModule, Routes } from '@angular/router';
      import { AuthGuardService } from './../providers';
      import { AdminComponent } from './../admin/admin.component';
      import { DashboardComponent } from './../admin/dashboard/dashboard.component';
      import { LoginComponent } from './../admin/login/login.component';
  
      import { CreateivrComponent } from '../share/createivr/createivr.component';
      import { CalllogComponent } from '../share/calllog/calllog.component';   
      //  canActivate: [AuthGuardService],
      var roles: [];
      var starting_url='users';
      roles = JSON.parse(localStorage.getItem('adminroles')); 
      if(roles!=null){
       if(roles.includes('View_Users_List')){
           starting_url="users";
       }
       else if(roles.includes('View_Request_List')){
           starting_url="request";
       }
       else if(roles.includes('View_Billing_List')){
           starting_url="billing";
       }
  
       else if(roles.includes('View_Android_List')){
           starting_url="android";
       }
       else{
           starting_url="users";
       }
  
  
      }
  
  
  
  
      const routes: Routes = [
      { path: 'login', component: LoginComponent },
      {
          path: '', canActivate: [AuthGuardService], component: AdminComponent,
          children: [
              { path: 'dashboard', component: DashboardComponent },
              { path: '', redirectTo: starting_url, pathMatch: 'full' },
              { path: 'users', loadChildren: './users/users.module#UsersModule' },
              { path: 'request', loadChildren: './request/request.module#RequestModule' },
              { path: 'android', loadChildren: './android/companylist.module#CompanylistModule' },
              { path: 'billing', loadChildren: './billing/billing.module#BillingModule' },
              { path: 'subadmin', loadChildren: './subadmin/subadmin.module#SubadminModule' },
              { path: 'createivr', component: CreateivrComponent },
              { path: 'calllog/:id', component: CalllogComponent },
              { path: 'createivr/:userid', component: CreateivrComponent },
              { path: 'editivr/:id/:userid', component: CreateivrComponent },
  
          ]
      }
      ];
  
      @NgModule({
      exports: [RouterModule],
      imports: [RouterModule.forChild(routes)]
      })
  
      export class AdminRouting { }
  </code></pre>
  
  <p>Is there any way? I have roles in localstorage. So I want to get localstorage value and set to default routes value in angular7, how to do this pleas help anyone? I'm new to angular and nodejs so please help anyone, please see above is my angular router file.</p>