Answers for "angular router"

11

generate module with routing in angular

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

angular navigate using component

import {Router} from '@angular/router'; // import router from angular router

export class Component{ 				// Example component.. 
	constructor(private route:Router){} 
  
  	go(){
		this.route.navigate(['/page']); // navigate to other page
	}
}
Posted by: Guest on May-08-2020
4

angular router

const routes: Routes = [
  { path: '',   redirectTo: '/first-component', pathMatch: 'full' }, // redirect to `first-component`
  { path: 'first-component', component: FirstComponent },
  { path: 'second-component', component: SecondComponent },
  { path: '**', component: PageNotFoundComponent },  // Wildcard route for a 404 page
];
Posted by: Guest on June-17-2021
6

angular router navigate

// Here’s a basic example using the navigate method:

goPlaces() {
  this.router.navigate(['/', 'page-name']);
}

/*
I hope it will help you.
Namaste
*/
Posted by: Guest on May-20-2020
1

Angular route

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HeroesComponent } from './heroes/heroes.component';

const routes: Routes = [
  { path: 'heroes', component: HeroesComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
Posted by: Guest on August-01-2021
2

how to create app.routing.module.ts in angular 6

ng generate module app-routing --flat --module=app
Posted by: Guest on May-11-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language