Description
I've got a custom form directive with an async validator. The validation is working and setting the field valid/invalid depending on if the validation promise resolves or rejects.
Trouble I am having is with getting the error message to come through. I am using the code:
scope.$broadcast('schemaForm.error.'+ngModel.$name, 'unique', 'That thing is not unique!');
and to clear the error message:
scope.$broadcast('schemaForm.error.'+ngModel.$name, 'unique', true);
is this not the proper way to set the custom error message? I tried setting it in my formDefaults validationMessage, "unique": "That thing is not unique"
and that works, but I would prefer to have the message coming from my validator.
unique is the name of the $asyncValidators entry, which doesn't seem to make a difference.