This library was generated with Angular CLI version 15.0.0.
- 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>
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. |
name | type | description |
---|---|---|
output | event | get the value of input. |
<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();
}