Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

dirty blurred class is not working correctly with new ngModelOptions #48

Closed
philippd opened this issue Nov 18, 2014 · 0 comments
Closed

Comments

@philippd
Copy link
Collaborator

AngularJS 1.3 introduced the option to update the model value on blur. This causes the logic in valdrInputDirective to fail because the blur handler is called before the model value has been updated/validated. The solution for #44, where probably a new directive for form groups will be introduced, could also fix this issue.

some pseudo-code:

valdrFormGroup directive

    var inputs = [];

    $watch(inputs, function () {
        if (input.wasBlurred && input.isDirty||touched && input.invalid) {
            addClass('dirty-blurred');
        }
    }

    setBlurred(input) {
        // keeps the state for the given input
    }



valdrInput requires valdrFromGroup

 input.on('blur', function () {
    valdrFormGroup.setBlurred(this);
    this.$blurred = true;  // OK? good idea to add or flags on ngModel? or use valdrBlurred?
});
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant