Skip to content

Accept query params in initialRoute property #406

Closed
@jwbaart

Description

@jwbaart

We're using query params to configure our feature when loading and have a redirect in place when missing to set those. When using the initalRoute property, to prevent the redirect, query params aren't accepted(link).
Navigation with query params is already available in a separate function.

it('allows initially rendering a specific route with query parameters', async () => {
    const initialRoute = 'initial-route?param=query';
    const routes = [
      { path: initialRoute, component: FixtureComponent },
    ];
    await render(RouterFixtureComponent, {
      initialRoute,
      routes,
    });

    const router = TestBed.inject(Router);

    expect(router.url).toEqual(initialRoute);
    // could also be implemented by actually reading the params from ActivatedRoute but is more complex and the above does the same
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions