Closed zorzysty closed 8 years ago
Hi @zorzysty! Thanks for your interest in angular-formly. It's not clear why would you need to set the ui-mask to undefined
, so it's hard to identify this as a bug or feature request. The best way to get help is by following the instructions here: http://help.angular-formly.com
This will make it easier for you to get help. Because the github issues are reserved for bug reports and feature requests, I'm going to go ahead and close this issue. See you on chat! Thanks!
@benoror How can I be more clear on why I need to set ui-mask to undefined? As I wrote "This is crucial for setting mask only if some other field has certain value."
Here's an example: You've got a postal code input and a country select. And you must display mask in postal code input only when certain country is selected, but no mask whatsoever for others.
As you can see here: https://htmlpreview.github.io/?https://github.com/angular-ui/ui-mask/master/demo/index.html there is a way to remove ui-mask from a field by setting it to undefined. But in Jsbin I provided you can see that setting it to undefined in expressionProperties breaks the model.
Please reopen the issue. It is a Formly bug and probably an easy fix.
Take a look at the example using a watcher
instead: http://jsbin.com/sukoga/1/edit?js,console,output
Check out this jsbin: http://jsbin.com/yekibehoqu/1/edit
First phone number input has mask attribute set to undefined in templateOptions and it works correctly - model is equal to the actual view value.
Second phone number input has mask attribute set to undefined in expressionProperties and this fails - model is never updated.
This is crucial for setting mask only if some other field has certain value.