1

I have some custom input fields which only allow specific characters as input.

For simplicity, let's assume these fields only accept numeric values. I'm using a directive which contributes to the $parsers flow as described here. This directive strips all undesired characters during input. This works great. Now I would like to perform an additional transformation step, which should take place, when the focus for the particular input is lost. In my use case, imagine I have an input such as 12345, and I would like to append .00 when the cursor leaves the input.

Is there some convenient hook, similar to the $parsers which I could exploit?

Community
  • 1
  • 1
qqilihq
  • 10,794
  • 7
  • 48
  • 89
  • 1
    I don't know of a similar hook that runs at blur. Angular tries very hard to update things as you type. Your best bet is probably to bind an handler to the blur event and just rewrite the field appropriately. – Chris Bouchard Jan 18 '15 at 03:35

0 Answers0