ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - dineeek/ngx-numeric-range-form-field: Angular Material UI numeric range input form field. It is based on control value accessor.
Angular Material UI numeric range input form field. It is based on control value accessor. - dineeek/ngx-numeric-range-form-field
Visit Site

GitHub - dineeek/ngx-numeric-range-form-field: Angular Material UI numeric range input form field. It is based on control value accessor.

GitHub - dineeek/ngx-numeric-range-form-field: Angular Material UI numeric range input form field. It is based on control value accessor.

ngx-numeric-range-form-field

An Angular Material UI numeric range input form field. Implementation is based on custom form field and control value accessor which allows inserting range numbers - minimum and maximum.

Numeric range form field

Maintenance code style: prettier FOSSA Status

Feature

  • Two inputs as one field.
  • Reactive form field.
  • Auto range validation & custom validation.

View live demo on StackBlitz.

Install

npm install ngx-numeric-range-form-field

Usage

Template:

<form [formGroup]="form">
  <ngx-numeric-range-form-field
    formControlName="range"
    label="Numeric range"
    (blurred)="onBlur()"
    (enterPressed)="onEnter()"
    (numericRangeChanged)="onNumericRangeChanged($event)"
  ></ngx-numeric-range-form-field>
</form>
form: FormGroup;

	constructor() {
		this.form = new FormGroup({
			range: new FormControl({
					minimum: 10,
					maximum: 100,
				}, [
				Validators.required, //optional
				Validators.min(10), //optional
				Validators.max(100), //optional
			]),
		});
	}

	onBlur(): void {
		console.log('Value', this.rangeControl.value);
	}

	onEnter(): void {
		console.log('Enter pressed!');
	}

	onNumericRangeChanged(value: INumericRange): void {
		console.log('Changed value: ', value);
	}

It is based on following type:

type INumericRange = {
  minimum: number;
  maximum: number;
};

Input property decorators:

  • label

    Set label of the field.

  • appearance

    Set MatFormFieldAppearance.

  • floatLabel

    Set FloatLabelType.

  • minPlaceholder & maxPlaceholder

    Set placeholder of the minimum value control. Defaulted to 'From'. Set placeholder of the maximum value control. Defaulted to 'To'.

  • readonly

    Set field value as readonly.

  • minReadonly & maxReadonly

    Set flag for separated readonly value.

  • resettable

    Set showing icon for resetting value in field.

  • requiredErrorMessage

    Set error message on required validation.

  • minimumErrorMessage & maximumErrorMessage

    Set error message on min & max value validation.

  • maximumErrorMessage

    Set error message on min value validation.

  • invalidRangeErrorMessage

    Set error message on invalid numeric range.

  • dynamicSyncValidators

    Set sync validators on runtime.

Output property decorators:

  • blurred

    Emit on blur out.

  • enterPressed

    Emit on enter press.

  • numericRangeChanged

    Emit on value change.

Contributing

Contributions are more than welcome!

License

MIT License

Copyright (c) 2022 Dino Klicek

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory