currency-input-component.md 3.6 KB


title: "CurrencyInputComponent" isDefaultIndex: false

generated: true

import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription';

CurrencyInputComponent

A form input control which displays currency in decimal format, whilst working with the integer cent value in the background.

Example

<vdr-currency-input
    [(ngModel)]="entityPrice"
    [currencyCode]="currencyCode"
></vdr-currency-input>
class CurrencyInputComponent implements ControlValueAccessor, OnInit, OnChanges, OnDestroy {
    @Input() disabled = false;
    @Input() readonly = false;
    @Input() value: number;
    @Input() currencyCode = '';
    @Output() valueChange = new EventEmitter();
    prefix$: Observable<string>;
    suffix$: Observable<string>;
    hasFractionPart = true;
    onChange: (val: any) => void;
    onTouch: () => void;
    _inputValue: string;
    readonly precision: number;
    readonly precisionFactor: number;
    constructor(dataService: DataService, currencyService: CurrencyService)
    ngOnInit() => ;
    ngOnChanges(changes: SimpleChanges) => ;
    ngOnDestroy() => ;
    registerOnChange(fn: any) => ;
    registerOnTouched(fn: any) => ;
    setDisabledState(isDisabled: boolean) => ;
    onInput(value: string) => ;
    onFocus() => ;
    writeValue(value: any) => void;
}
  • Implements: ControlValueAccessor, OnInit, OnChanges, OnDestroy
### disabled ### readonly ### value ### currencyCode ### valueChange ### prefix$ ### suffix$ ### hasFractionPart ### onChange ### onTouch ### _inputValue ### precision ### precisionFactor ### constructor DataService, currencyService: CurrencyService) => CurrencyInputComponent`} /> ### ngOnInit `} /> ### ngOnChanges `} /> ### ngOnDestroy `} /> ### registerOnChange `} /> ### registerOnTouched `} /> ### setDisabledState `} /> ### onInput `} /> ### onFocus `} /> ### writeValue void`} />