Answers for "--routing angular"

11

generate module with routing in angular

ng g m [ModuleName] --routing
Posted by: Guest on June-30-2020
6

redirect angular

import { RoleComponent } from './role/role.component';
import { AppComponent } from './app.component';
import { NgModule }             from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  { path: '', redirectTo: '/AppComponent', pathMatch: 'full' },
  { path: 'role', component: RoleComponent },

];

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})
export class AppRoutingModule {
  constructor(private router: Router)
}

functionOnWhichRedirectShouldHappen(){
  router.navigate(['/role']);
}
Posted by: Guest on February-27-2020
2

angular routing

// create a new project with routing enabled
      ng new routing-app --routing
Posted by: Guest on March-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language