ngx-input-numeric
v3.0.0
Published
Added reset api.
Downloads
4
Maintainers
Readme
NgxNumericInput
This library was generated with Angular CLI version 15.0.0.
How to use it:
- import NgxNumericInput module inside the desrired moduel for example AppModule.ts
import { NgxNumericInputModule } from 'ngx-input-numeric'; import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; @NgModule({ declarations: [AppComponent], imports: [BrowserModule, NgxNumericInputModule], providers: [], bootstrap: [AppComponent], }) export class AppModule {}
3.Inside the template file:
<div>
<ngx-input-numeric
[dir]="'rtl'"
(output)="getData($event)"
[isRequired]="true"
></ngx-input-numeric>
</div>
Inputs
| name | type | dsescription | | :------------: | ------- | :-------------------------------------- | | isRequired | boolean | making input required. | | value | string | default value for input. | | placeholder | string | placeholder. | | dir | string | 'rtl' or 'ltr' | | errorMessage | string | errorMessage to show in required state. | | hasPlaceholder | boolean | To disable or enable placeholder. | | reset() | method | An api to reset input. |
Outputs
| name | type | description | | ------ | ----- | ----------------------- | | output | event | get the value of input. |
How to reset:
<ngx-input-numeric
[dir]="'rtl'"
(output)="getData($event)"
[isRequired]="true"
[hasPlaceholder]="false"
#temp
></ngx-input-numeric>
inside .ts file:
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
title = 'numeric-input';
@ViewChild('temp') input!: NgxNumericInputComponent;
getData(event: string) {}
resetForm() {
this.input.reset();
}