🚨 Announcing Vendure v2 Beta

CurrencyInputComponent

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>

Signature

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;
  constructor(dataService: DataService, changeDetectorRef: ChangeDetectorRef)
  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

Members

disabled

property
type:

readonly

property
type:

value

property
type:
number

currencyCode

property
type:

valueChange

property
type:

prefix$

property
type:
Observable<string>

suffix$

property
type:
Observable<string>

hasFractionPart

property
type:

onChange

property
type:
(val: any) => void

onTouch

property
type:
() => void

_inputValue

property
type:
string

constructor

method
type:
(dataService: DataService, changeDetectorRef: ChangeDetectorRef) => CurrencyInputComponent

ngOnInit

method
type:
() =>

ngOnChanges

method
type:
(changes: SimpleChanges) =>

ngOnDestroy

method
type:
() =>

registerOnChange

method
type:
(fn: any) =>

registerOnTouched

method
type:
(fn: any) =>

setDisabledState

method
type:
(isDisabled: boolean) =>

onInput

method
type:
(value: string) =>

onFocus

method
type:
() =>

writeValue

method
type:
(value: any) => void