You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I believe this is rarely witnessed but it is better to be logically fixed.
Here is the scenario:
A component with currencyMask on a form control is defined and is being rendered. Before the GUI finished rendering, immediately, you destroy this component, by router change for example. An TypeError for reading 'setOnModelChange' will be thrown.
This is because Angular clean up control before destroying the component and any controls with valueAccessor will call registerOnChange and registerOnTouch during this cleanup procedure.
In our registerOnChange and registerOnTouch function, we call setOnModelChange directly from the handler, which is created in ngOnInit. So in the scenario above, the handler was not created yet and the registerOnChange is called.
I suggest to use this._handler?.setOnModelChange instead, so it is safer. ngx-currency.directive.ts
The text was updated successfully, but these errors were encountered:
Hi I believe this is rarely witnessed but it is better to be logically fixed.
Here is the scenario:
A component with
currencyMask
on a form control is defined and is being rendered. Before the GUI finished rendering, immediately, you destroy this component, by router change for example. An TypeError for reading 'setOnModelChange
' will be thrown.This is because Angular clean up control before destroying the component and any controls with
valueAccessor
will callregisterOnChange
andregisterOnTouch
during this cleanup procedure.In our
registerOnChange
andregisterOnTouch
function, we callsetOnModelChange
directly from the handler, which is created inngOnInit
. So in the scenario above, the handler was not created yet and theregisterOnChange
is called.I suggest to use
this._handler?.setOnModelChange
instead, so it is safer.ngx-currency.directive.ts
The text was updated successfully, but these errors were encountered: