Object.setRawValue get error
I use angularjs and get error:
angular.min.js?d=1060806703:114 TypeError: Cannot read property 'toString' of undefined at Object.setRawValue (cleave-angular.min.js?d=403551635:8) at Array.
(cleave-angular.min.js?d=403551635:8) at angular.min.js?d=1060806703:277 at m.$digest (angular.min.js?d=1060806703:138) at m.$apply (angular.min.js?d=1060806703:141) at g (angular.min.js?d=1060806703:94) at t (angular.min.js?d=1060806703:98) at XMLHttpRequest.u.onload (angular.min.js?d=1060806703:99)
Could you tell me to fix it?
Can you please share more details about how you use it, any jsfiddle file?
https://jsfiddle.net/o7nejrsg/
This seems to happen on initial load when the model property isn't defined in the controller yet. The Angular directive will kick off the formatter and pass undefined to setRawValue. Can be easily fixed by changing
$scope.cleave.setRawValue(val);
into
$scope.cleave.setRawValue(val ? val : '');
@markleusink Thanks a lot, I will push a fix to include the check in the method.
@markleusink Oh, just saw your PR, will merge later. Cheers
Thanks very much