Skip to content

Custom Message

nelsonomuto edited this page Feb 6, 2014 · 2 revisions

angular-ui-form-validation allows you to have your own custom messages that override the error message of the validation directive.

You use this by passing in an object with a message property whose value is the custom message you wish to be applied by the directive if the validation it tests fails.

    <label for="firstname">First Name</label>
    
    <input type="text" id="firstname" name="firstname" ng-model="user.firstname"
      validation-min-length="{ value: 5, message: 'min length custom error message' }"  
    />

See plunker for a live demo: http://plnkr.co/edit/jaBKpF?p=preview