Skip to content
This repository has been archived by the owner on Jul 1, 2020. It is now read-only.

angularValidation.revalidate problems #150

Closed
jsolt opened this issue Apr 14, 2017 · 5 comments
Closed

angularValidation.revalidate problems #150

jsolt opened this issue Apr 14, 2017 · 5 comments

Comments

@jsolt
Copy link
Contributor

jsolt commented Apr 14, 2017

I'm having a problem using angularValidate.revalidate.

It looks like the change introduced in v1.5.13 broke it, because if I switch back to 1.5.12 it works.

I used the punker in the wiki: http://plnkr.co/o1fftbnmRfjScEDmi7ZH?p=preview and it works, but it's got the old code. If I copied the most recent code in it stops working.

@ghiscoding
Copy link
Owner

ghiscoding commented Apr 14, 2017

Latest version is 1.5.18, you're quite behind. Can you troubleshoot and find the problem, because I don't have much time to look into this right now.

Try with latest version just to see

@jsolt
Copy link
Contributor Author

jsolt commented Apr 14, 2017

I was on 1.5.18 when I noticed it, I narrowed it down to the 1.5.13 change (I think)

I think it's this in validation-directive.js

        scope.$on('angularValidation.revalidate', function(event, args){
          if (args == ctrl.$name)
          {
            ctrl.revalidateCalled = true;
            var value = ctrl.$modelValue;

            if (!!elm && elm.hasOwnProperty("isValidationCancelled")) {
              // attempt to validate & run validation callback if user requested it
              var validationPromise = attemptToValidate(value);
              if(!!_validationCallback) {
                commonObj.runValidationCallbackOnPromise(validationPromise, _validationCallback);
              }
            }
            else {
              ctrl.$setValidity('validation', true);
            }
          }
        });

elm.hasOwnProperty("isValidationCancelled") doesn't seem to ever evaluate to true.

I'm not 100% sure, but I think elm is wrong type of thing to be evaluating, that other parts of the code are setting that property on a different object.

@ghiscoding
Copy link
Owner

What I suggest you to do is to debug it using the plunker sample you got and use validation-directive.js of version 1.5.18 and then revert some of the code change of the old version vs new version until you find the culprit. If you can find what it is, I can help out afterward.

Thanks for the help

ghiscoding added a commit that referenced this issue Apr 18, 2017
Thanks to @jsolt for fixing the issue
@ghiscoding
Copy link
Owner

New release v1.5.19 pushed with your fix. Thanks again for the contribution :)

@jsolt
Copy link
Contributor Author

jsolt commented Apr 18, 2017

Awesome, thanks for the super quick turnaround, now we're up to the latest version again :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants