How to implement RouteReuseStrategy shouldDetach for specific routes in Angular 2

Hey Anders, great question! I’ve got almost the same use case as you, and wanted to do the same thing! User search > get results > User navigates to result > User navigates back > BOOM blazing fast return to results, but you don’t want to store the specific result that the user navigated to. … Read more

In Angular, What is ‘pathmatch: full’ and what effect does it have?

While technically correct, the other answers would benefit from an explanation of Angular’s URL-to-route matching. I don’t think you can fully (pardon the pun) understand what pathMatch: full does if you don’t know how the router works in the first place. Let’s first define a few basic things. We’ll use this URL as an example: … Read more

Angular 5 Scroll to top on every Route click

There are some solutions, make sure to check them all 🙂 Option1: The router outlet will emit the activate event any time a new component is being instantiated, so we could use (activate) to scroll (for example) to the top: app.component.html <router-outlet (activate)=”onActivate($event)”></router-outlet> app.component.ts onActivate(event) { // window.scroll(0,0); window.scroll({ top: 0, left: 0, behavior: ‘smooth’ … Read more

Passive Link in Angular 2 – equivalent

If you have Angular 5 or above, just change <a href=”” (click)=”passTheSalt()”>Click me</a> into <a [routerLink]=”” (click)=”passTheSalt()”>Click me</a> A link will be displayed with a hand icon when hovering over it and clicking it won’t trigger any route. Note: If you want to keep the query parameters, you should set queryParamsHandling option to preserve: <a … Read more

Angular: How to update queryParams without changing route

You can navigate to the current route with new query params, which will not reload your page, but will update query params. Something like (in the component): import {ActivatedRoute, Router} from ‘@angular/router’; constructor( private router: Router, private activatedRoute: ActivatedRoute, ) { } public myMethodChangingQueryParams() { const queryParams: Params = { myParam: ‘myNewValue’ }; this.router.navigate( [], … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)