Kristiyan Kostadinov 81d72a1e37 fix(router): migration incorrectly replacing deprecated key (#39763)
In #38762 we added a migration to replace the deprecated `preserveQueryParams`
option with `queryParamsHandling`, however due to a typo, we ended up replacing it
with `queryParamsHandler` which is invalid.

Fixes #39755.

PR Close #39763
2020-11-19 09:08:10 -08:00

913 B

Router's NavigationExtras.preserveQueryParams migration

Previously the NatigationExtras property of preserveQueryParams defined what should be done with query parameters on navigation. This migration updates the usages of preserveQueryParams to instead use the queryParamsHandling property.

Before

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

@Component({})
export class MyComponent {
  constructor(private _router: Router) {}

  goHome() {
    this._router.navigate('/', {preserveQueryParams: true, skipLocationChange: 'foo'});
  }
}

After

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

@Component({})
export class MyComponent {
  constructor(private _router: Router) {}

  goHome() {
    this._router.navigate('/', { queryParamsHandling: 'preserve', skipLocationChange: 'foo' });
  }
}