thelebdev / ng2-currency-mask

A very simple currency mask directive that allows using a number attribute with the ngModel.
MIT License
0 stars 3 forks source link

FIX: TypeError: Cannot set property 'align' of undefined #6

Open guillep2k opened 5 years ago

guillep2k commented 5 years ago

There's an issue in the original project about this problem, and there are instructions to deal with it. They could be implemented in this fork.

Migrated from original project (https://github.com/cesarrew/ng2-currency-mask/issues/123) - Follow to find the fix.

Orignal request by @diegotakeo

Hello, Currently I am having the following error "TypeError: Cannot set property 'align' of undefined" as I run karma test with any components that make use of the CurrencyMaskModule.

I am using Angular 6 and the v5.3.1 of ng2-currency-mask.

The error disappears as I comment line 33 of the currency-mask.directive.js this.elementRef.nativeElement.style.textAlign = this.options.align ? this.options.align : this.optionsTemplate.align;

This issue only appears with ng test but nothing wrong with the ng serve. Any ideas?