Answers for "angular ** route"

5

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

angular routing

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

how to add changes every time you route navigate to page in angular

// Place import at the top
import { Router,NavigationStart} from '@angular/router';

//Place the code below inside your class
constructor(private router: Router){}

ngOnInit(){
   this.router.events.subscribe(event =>{
      if (event instanceof NavigationStart){
   		
      }
   })
}
Posted by: Guest on March-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language