Skip to content

validator.provider -> validate promise -> error is not called after all the validators execute #53

@ionutmandra

Description

@ionutmandra

Hi.
I have let's say 5 validators on a form. On save, i would like to be notified when validation fails, so I can iterate over the failed validators and have some logic.

The problem is that after first validation fails, it calls validatedError function, which calls the validate promise error, ( if (count.error++ === 0) { call promise ) so i get notified that my validation operation failed, but I cant detect when all the validators are completed. A quick and dirty fix would be to change the validatedError and instead of x(); to have $timeout(function () { x(); });, so the root promise error would still be called just one time, but after all the operations on current stack (all validators operatios) complete.

I understand that each control get marked as invalid after all validations happen, and that my $validator.validate(...).success(function () {}).error(function () {}); error get's called, but is there any way to know when all validations are completed ? maybe I am missing some info at this point

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions