angular-ui / ui-mask

Mask on an input field so the user can only type pre-determined pattern
https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html
MIT License
391 stars 258 forks source link

Object given as ui-options shouldn't get assigned to #226

Open jrencz opened 7 years ago

jrencz commented 7 years ago

I decided to store an object that is common to some of my masked fields on a module. Module gets imported to the controller module and the object is assigned onto the controller. Then the object is passed to ui-options via template expression.

It happened that I defined the original module using Object.freeze. I got an error saying that It's not possible to extend the object. It seems like when expression in ui-options attribute gets evaluated defaults are assigned onto it. Correct behaviour would be to assign first defaults, then local overrides onto a fresh object each time.