Nested Parenthetical Madness

    md-form-validator

    0.1.15 • Public • Published

    Angular Material Design Form Validator

    A collection of directives that simplify the form validation with the Angular Material Design

    Demo

    How to install

    bower install --save md-form-validator

    Config Default Messages

    angular.module("myApp").config(function(mdFormValidatorProvider) {
        mdFormValidatorProvider.setMessage("required", "This field is required");
        mdFormValidatorProvider.setMessage("maxlength", "Please enter no more than {maxlength} characters");
    }]);

    With default messages you don´t need to add a md-message() for each validation:

    Before:

    <md-input-container>
      <label>Código</label>
      <input ng-model="code" name="code" required/>
      <md-messages>
        <md-message required>Required</md-message>
      </md-messages>
    </md-input-container>

    After default messages:

    <md-input-container>
      <label>Código</label>
      <input ng-model="code" name="code" required/>
      <md-messages />
    </md-input-container>

    To override the message:

    <md-input-container>
      <label>Código</label>
      <input ng-model="code" name="code" required/>
      <md-messages>
        <md-message required>
          This is my cool required message for this field
        </md-message>
      </md-messages>
    </md-input-container>

    Keywords

    none

    Install

    npm i md-form-validator

    DownloadsWeekly Downloads

    7

    Version

    0.1.15

    License

    MIT

    Last publish

    Collaborators

    • danieloprado