What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-10 17:28:04
angular material open last visited tab
constructor(private route: ActivatedRoute, private router: Router) {} selectedTabIndex: number; ngOnInit(): void { this.selectedTabIndex = parseInt(this.route.snapshot.queryParamMap.get('tab'), 10); // TODO: check upper bound. Material will set th... Add solution -
TypeScript 2021-09-09 06:45:03
pass data in route angular
// Send user data let navigationExtras: NavigationExtras = { state: { user: this.user } this.router.navigate(['details'], navigationExtras); // Acess data in details page .... constructor(private route: ActivatedRoute, private router: Router) { th... Add solution -
Other 2021-09-08 14:08:02
Back button directive Angular
/** Navigation service ***/ import { Injectable } from '@angular/core' import { Location } from '@angular/common' import { Router, NavigationEnd } from '@angular/router' @Injectable({ providedIn: 'root' }) export class NavigationService { private hist... Add solution -
Javascript 2021-09-07 19:16:02
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: '', re... Add solution -
Javascript 2021-09-06 14:44:02
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 Naviga... Add solution -
Javascript 2021-09-06 05:36:02
queryparams angular
goProducts() { this.router.navigate(['/products'], { queryParams: { order: 'popular' } }); } http://localhost:4200/products?order=popular constructor(private route: ActivatedRoute) { } ngOnInit() { this.route.queryParams .filter(params =... Add solution