redirect angular April 13, 2023 by wordlinkanswers redirect angular Comment 11 import { RoleComponent } from ‘./role/role.component’;<br /> import { AppComponent } from ‘./app.component’;<br /> import { NgModule } from ‘@angular/core’;<br /> import { RouterModule, Routes } from ‘@angular/router’;</p> <p>const routes: Routes = [<br /> { path: ”, redirectTo: ‘/AppComponent’, pathMatch: ‘full’ },<br /> { path: ‘role’, component: RoleComponent },</p> <p>];</p> <p>@NgModule({<br /> imports: [ RouterModule.forRoot(routes) ],<br /> exports: [ RouterModule ]<br /> })<br /> export class AppRoutingModule {<br /> constructor(private router: Router)<br /> }</p> <p>functionOnWhichRedirectShouldHappen(){<br /> router.navigate([‘/role’]);<br /> } Popularity 10/10 Helpfulness 7/10 Language javascript Source: stackoverflow.com Tags: angular javascript redirect Share Link to this answer Share Contributed on Feb 27 2020 Wild Wildebeest 0 Answers Avg Quality 2/10 wordlinkanswers