ngx-currency icon indicating copy to clipboard operation
ngx-currency copied to clipboard

Event (input) dosen't work

Open pookdeveloper opened this issue 5 years ago • 20 comments
trafficstars

Event (input) dosen't work, Im actually use google chrome

<input` type="text" (input)="calculatePrice(rowData)" currencyMask
                    [options]="{ prefix: ' ', thousands: '.', decimal: ',', max :'1000000'  }"
                    [(ngModel)]="rowData.amount">

Thanks

pookdeveloper avatar Apr 23 '20 10:04 pookdeveloper

I am facing this issue too. Chrome Version: Version 81.0.4044.129.

TAharshalcarpenter avatar May 07 '20 19:05 TAharshalcarpenter

it works with key events though

fabioemoutinho avatar May 11 '20 15:05 fabioemoutinho

it works with key events though

You say keypress keyup etc.. ? Is not the same behaviour ..

pookdeveloper avatar May 11 '20 15:05 pookdeveloper

it works with key events though

You say keypress keyup etc.. ? Is not the same behaviour ..

yes. (keyup), (keydown), (keypress) events work. idk why input/change are not working

fabioemoutinho avatar May 11 '20 17:05 fabioemoutinho

@mfabioe Its because of this area:

@HostListener("input", ["$event"])
  handleInput(event: any) {
    // This Line ------------------
    if (this.isChromeAndroid()) {
      !this.isReadOnly() && this.inputHandler.handleInput(event);
    }
  }

On all other events it is if(!this.isChromeAndroid())

But I don't know why that condition is there in first place. If someone can investigate it..

https://github.com/nbfontana/ngx-currency/blob/master/src/currency-mask.directive.ts Line 86

Edit: I think the if (this.isChromeAndroid()) { should be if (!this.isChromeAndroid()) {

TAharshalcarpenter avatar May 11 '20 17:05 TAharshalcarpenter

I am facing the same issue. Change event doesn't work. Is it because NG_VALUE_ACCESSOR? My input:

<input [options]="{align : 'left', prefix: 'R$ '}" 
  matInput formControlName="valor" currencyMask required
  (change)="test()">

didiokener avatar May 22 '20 00:05 didiokener

I am facing the same issue. Change event doesn't work. Is it because NG_VALUE_ACCESSOR? My input:

<input [options]="{align : 'left', prefix: 'R$ '}" 
  matInput formControlName="valor" currencyMask required
  (change)="test()">

yes, indeed change or input doesn't work, first I thought it's angular 10 but it doesn't work in 9 too.

mxmp210 avatar Jul 11 '20 14:07 mxmp210

I'm facing the same, did you guys come up with something? (v1.5.2 - yep, I know, outdated)

giovannipds avatar Dec 14 '20 23:12 giovannipds

As far as I've tested here, I could bind change, keypress and keyup, but couldn't keydown neither input.

giovannipds avatar Dec 14 '20 23:12 giovannipds

I was able to get a similar behavior with keypress and blur but, of course, it's not equal to input event, unfortunately.

giovannipds avatar Dec 14 '20 23:12 giovannipds

With the updated version (2.5.2) I could use keyup, keydown, keypress but couldn't use input or change.

giovannipds avatar Dec 15 '20 16:12 giovannipds

The best alternative solution for me was to use keyup.

giovannipds avatar Dec 15 '20 16:12 giovannipds

The best alternative solution for me was to use keyup.

This is a pretty good alternative, thanks for pointing that out!

Zwimber avatar Dec 23 '20 21:12 Zwimber

Is this bug being solved? This is a very serious problem for componte's life.

ricardolerma avatar Feb 22 '21 12:02 ricardolerma

I have solved this issue with setter/getter property which binded to ngModel of input. On setter I have handled valuechange event.

ozcanavtat avatar Oct 07 '22 15:10 ozcanavtat

I'm facing the same issue in version 3.0.0

NayaraGoulart avatar May 27 '23 10:05 NayaraGoulart

is this lib still active?

Gabiruti avatar Mar 14 '24 15:03 Gabiruti

@Gabiruti The author does not develop new features, but accepts PR, although not quickly https://github.com/nbfontana/ngx-currency/pull/169#issuecomment-1636160301

ArtemDintecom avatar Mar 14 '24 21:03 ArtemDintecom