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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sinasiri/ngs-1000-separator

v0.0.2

Published

An Angular directive that automatically formats numeric input fields with thousand separators as the user types — no pipe, no extra component, just add the attribute.

Downloads

293

Readme

ngs-1000-separator

An Angular directive that automatically formats numeric input fields with thousand separators as the user types — no pipe, no extra component, just add the attribute.

1000000  →  1,000,000
9999.99  →  9,999.99
-5000    →  -5,000

Installation

npm install @sinasiri/ngs-1000-separator

Requirements

| Package | Version | |---|---| | @angular/core | >= 17.0.0 | | @angular/common | >= 17.0.0 |


Setup

Import the directive into your standalone component or module:

// standalone component
import { Ngs1000Separator } from '@sinasiri/ngs-1000-separator';

@Component({
  imports: [Ngs1000Separator],
  template: `<input Ngs1000Separator type="text" />`
})
export class MyComponent {}
// NgModule
import { Ngs1000Separator } from '@sinasiri/ngs-1000-separator';

@NgModule({
  imports: [Ngs1000Separator]
})
export class MyModule {}

Usage

Basic input

<input Ngs1000Separator type="text" />

The directive formats the value on every keystroke. The user sees 1,000,000 but your model receives the raw number 1000000.


With Reactive Forms

form = new FormGroup({
  amount: new FormControl(null)
});
<input Ngs1000Separator type="text" [formControl]="form.controls.amount" />

The value stored in the form control is always the raw numeric value — the formatted display is only visual.


With Template-Driven Forms

<input Ngs1000Separator type="text" [(ngModel)]="amount" />

With an initial value

The directive formats pre-filled values on init:

form = new FormGroup({
  salary: new FormControl(75000)  // renders as 75,000
});

Negative numbers

Negative values are fully supported:

-1500  →  -1,500

Decimal values

Decimals are preserved exactly as typed:

9999.99  →  9,999.99

Behaviour

| Scenario | Behaviour | |---|---| | User types 1000000 | Displays 1,000,000 | | Form control receives 75000 | Displays 75,000 | | User types -5000 | Displays -5,000 | | User types 9999.99 | Displays 9,999.99 | | Field is empty | No formatting applied | | Field is disabled | Respects disabled state |

The model / form control value is always the raw number (e.g. 1000000), never the formatted string.


API

Selector

[Ngs1000Separator]

Apply as an attribute on any <input> element.

ControlValueAccessor

The directive implements ControlValueAccessor, so it works seamlessly with both Reactive Forms and Template-Driven Forms without any extra configuration.


Contributing

Pull requests are welcome. For major changes, open an issue first to discuss what you'd like to change.

# clone the repo
git clone https://github.com/sinasiri/ngs-1000-separator.git
cd ngs-1000-separator

# install dependencies
npm install

# build the library
ng build ngs-1000-separator

# serve the demo app
ng serve ngs-1000-separator-demo

License

MIT