formly-js / angular-formly-website

The website for angular-formly
http://angular-formly.com
18 stars 26 forks source link

New Example: replace spaces with underscores as user types #63

Open jaymorgan opened 9 years ago

jaymorgan commented 9 years ago

I can't seem to wrap my head around this. I want to be able to replace spaces with underscores in a field as someone types. Seems like it should be easy to do but I'm not able to out it together. Is this already addressed somewhere?

kentcdodds commented 9 years ago

You could probably use ng-mask for this: http://angular-formly.com/#/example/very-advanced/ng-mask

jaymorgan commented 9 years ago

I want it to actually change the value in the model though. This would only alter how the value is displayed, right?

kentcdodds commented 9 years ago

Ah, yes, that's true. You'll want to look into the new parsers property that utilizes the $parsers api from angular. It's not very well documented and there's no example yet, but here's the issue that describes how it works: https://github.com/formly-js/angular-formly/issues/368