npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ngx-query-params-plus

v1.0.1

Published

Advanced Angular service for managing URL query params with reactive features, debounce handling and state sync.

Readme

ngx-query-params-plus

A lightweight Angular service for managing and synchronizing URL query parameters. Supports debounced updates, toggle/cycle values, list manipulation, and reactive observables.


Features

  • Get, set, and remove query parameters easily
  • Set parameters only if they don't exist
  • Toggle between values or boolean states
  • Cycle through a list of predefined values
  • Append/remove items in list-type parameters
  • Observe all query parameter changes (debounced)
  • Observe changes to individual query parameters
  • Sync state from the current route snapshot

Installation

npm install ngx-query-params-plus

Usage

Import the service in your Angular components or services:

import { Component } from '@angular/core';
import { QueryParamsService } from 'ngx-query-params-plus';

@Component({
  selector: 'app-demo',
  templateUrl: './demo.component.html'
})
export class DemoComponent {
  constructor(private queryParams: QueryParamsService) {}

  ngOnInit() {
    // Get a query param
    const foo = this.queryParams.getParam('foo');

    // Set a query param
    this.queryParams.setParam('foo', 'bar');

    // Toggle a boolean param
    this.queryParams.toggleBoolean('isVisible');

    // Cycle a param through multiple values
    this.queryParams.cycleParam('mode', ['light', 'dark', 'auto']);

    // Observe changes
    this.queryParams.onParamChange('foo').subscribe(value => {
      console.log('foo changed:', value);
    });
  }
}

API

Getters

  • getParams(): Record<string, any> – Returns all non-null params
  • getParam<T>(key: string): T | null – Get a single param
  • getParamOrDefault<T>(key: string, fallback: T): T – Get a param or fallback
  • requireParam<T>(key: string): T – Throws if the param is missing
  • hasParam(key: string): boolean – Checks if param exists
  • getParamKeys(): string[] – Returns all non-null keys

Setters

  • setParam(key: string, value: any) – Set a single param
  • setParams(params: Record<string, any>) – Set multiple params
  • setParamIfNotExists(key: string, value: any) – Set if missing
  • setNumberParam(key: string, value: any) – Convert value to number
  • setNullableParam(key: string, value: any) – Convert empty string to null

Removal

  • removeParam(key: string) – Remove a single param
  • clearParams() – Clear all params
  • removeParamIf(key: string, predicate: (value: any) => boolean)
  • removeParamsIf(predicate: (key: string, value: any) => boolean)

Toggle / Cycle / List

  • toggleParam(key: string, valueA: any, valueB: any) – Toggle between two values
  • toggleBoolean(key: string) – Toggle boolean
  • cycleParam(key: string, values: any[]) – Cycle through a list
  • appendToListParam(key: string, item: any) – Add to list param
  • removeFromListParam(key: string, item: any) – Remove from list param

Observables

  • onParamsChange(): Observable<Record<string, any>> – Debounced changes
  • onParamChange<T>(key: string): Observable<T | undefined> – Observe a single param

Sync

  • syncFromRoute(): void – Sync state from the current route snapshot

Configuration

You can configure the debounce time by providing a value for the QUERY_PARAMS_DEBOUNCE_MS injection token:

import { NgModule } from '@angular/core';
import { QUERY_PARAMS_DEBOUNCE_MS } from 'ngx-query-params-plus';

@NgModule({
  providers: [
    { provide: QUERY_PARAMS_DEBOUNCE_MS, useValue: 100 }
  ]
})
export class AppModule {}

Default debounce is 50ms.


License

MIT