Skip to content

Instantly share code, notes, and snippets.

@imbalind
Created February 7, 2016 18:00
Show Gist options
  • Save imbalind/f92f12477b0839e6e712 to your computer and use it in GitHub Desktop.
Save imbalind/f92f12477b0839e6e712 to your computer and use it in GitHub Desktop.
Live validation thread
@YonatanKra
Copy link

Thanks @imbalind. Here are my 2 cents:

  • I agree with most of your points. It was never meant to replace your validator - only enhance it. What I've sent is a POC. It works along with your great validator, and adds the live edit to it as well as the integration with ngForm (in my app the grid (or several of them) are a part of a bigger form).
  • I'm working with enterprise apps only, and they expect this behavior (I've created something somewhat similar in my own app, but really liked your validator so decided to go along :)).
  • Enable/disable is definitely a must with every feature, and I think for every column as well. Not every column needs live validation.
  • I've used the $parser because it handles live edit of the input the "angular" way, without adding a new $watch.
  • Regarding how to know which validations failed - I think you could return the promises from the runValidators method, so anyone using it could tell what has failed "live" (I'm using a timeout there, but it's bad practice - promises are much more reliable).
  • the addValidator assumes you are using an input to edit. Is there another scenario in which you would like live editing?
  • I also don't like the while there. Any good ideas on how to get the cell element without it? I think that jQuery's solution (parentsUntil) works roughly the same...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment