ERROR: Cannot read property 'apply' of undefined and ERROR: this.onModelChange is not a function
See original GitHub issueWhen I use the example:
<input
currencyMask
value="numberValue1"
[options]="{ prefix: 'R$ ', thousands: '.', decimal: ',' }"
/>
I get the following error when I click on the input and then click somewhere else:
core.js:5828 ERROR TypeError: Cannot read property 'apply' of undefined
at CurrencyMaskDirective.handleBlur (ngx-currency.js:437)
at CurrencyMaskDirective_blur_HostBindingHandler (ngx-currency.js:482)
at executeListenerWithErrorHandling (core.js:21593)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:21635)
at HTMLInputElement.<anonymous> (platform-browser.js:934)
at ZoneDelegate.invokeTask (zone-evergreen.js:400)
at Object.onInvokeTask (core.js:40744)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Zone.runTask (zone-evergreen.js:168)
at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:481)
And when I’m changing the values in the input I get the following error:
core.js:5828 ERROR TypeError: this.onModelChange is not a function
at InputHandler.handleKeypress (ngx-currency.js:363)
at CurrencyMaskDirective.handleKeypress (ngx-currency.js:456)
at CurrencyMaskDirective_keypress_HostBindingHandler (ngx-currency.js:482)
at executeListenerWithErrorHandling (core.js:21593)
at wrapListenerIn_markDirtyAndPreventDefault (core.js:21635)
at HTMLInputElement.<anonymous> (platform-browser.js:934)
at ZoneDelegate.invokeTask (zone-evergreen.js:400)
at Object.onInvokeTask (core.js:40744)
at ZoneDelegate.invokeTask (zone-evergreen.js:399)
at Zone.runTask (zone-evergreen.js:168)
The application is running on Angular 9
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:10
Top Results From Across the Web
Cannot read property '$apply' of undefined - Stack Overflow
I have research through the internet with this popular error and I have found no solution to my problem. What ...
Read more >ng2-currency-mask - Bountysource
It works but I got this error message at the console. ERROR TypeError: Cannot read property 'setValue' of undefined at CurrencyMaskDirective.writeValue ( ...
Read more >CANNOT READ PROPERTY 'APPLY' OF UNDEFINED
The message states that the button has no click-handler so it seems that the click handler (onResolvedOnlyClick) should be added not in the ......
Read more >Uncaught TypeError: Cannot read property 'apply' of undefined
When trying to change theme component setting, clicking the green check button produces the following error, changes are not saved ...
Read more >2013 - Uncaught TypeError: Cannot read property 'apply' of ...
I can see following issues in the code: In the line var listEnumerator = lists.getEnumerator();. the variable 'lists' is undefined, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m not using ngModel, using reactive forms, any way around this?
Hey guys, let me share with you what I did… I just used the both attributes in the input: ngModel and ngModelChange. Like this:
<input currencyMask type="text" [(ngModel)]="valor" (ngModelChange)="teste()" [options]="{ align: 'left', prefix: 'R$ ', thousands: '.', decimal: ',', allowNegative: 'false', min: 0, max: 500000 }">After this, the error message disappeared.
I hope it can help you!