Skip to content

validationMessage for custom validators #268

@plong0

Description

@plong0

I have created a custom form type, which adds a directive to the input. In the directive's link, I am adding a custom $validator to ngModel:

ngModel.$validators.foo = function(modelValue, viewValue){
  var value = modelValue || viewValue;
  return (value == 'bar');
};

(actual validator is more complex, so a simple tv4 pattern is not enough)

How can I set a custom message for this validation? I would have thought {validationMessage: {foo: "Foo is not bar!"}} would have done it... but the error message renders as [object Object]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions