Skip to content

it-crowd/angular-js-itc-utils

Repository files navigation

angularjs-itc-utils

Build Status

To run a project

npm install 
bower install
grunt test:e2e 
grunt serve 

Directives

itcSubmit

Works similar as ngSubmit, but prevents submitting if form is invalid or empty.

Usage:
  <form name="registerForm" itc-submit="register()"> 

itcDefaultMessage

Displays popovers as a descriptions to the inputs. Shows on the focus event and disappears on blur.

Usage:
  <input itc-default-message="Enter your password"> 

itcValidationMessages

Iterates through all inputs in form and displays validations messages. Inputs should have a name attribute, because Angular doesn't bind their to the scope.

Usage:
  <form name="registerForm" itc-validation-messages> 
Options:

Default event is keyup, but you can change it to a focus by adding: itc-validation-messages-event="blur"

Default way to show messages is popover, but you can change it to a block under the input: itc-validation-message-type="block"

Example:
  <form name="registerForm" itc-validation-messages itc-validation-messages-event="blur" itc-validation-message-type="block"> 

Default messages are taking from ValidationMessages constant list, but you can change it by adding to the selected input: error_key-message="Provide longer email" Where error_key is a name of error key from $error table.

Example:
  <input type="email" minlength-message="Provide longer email"> 

TODO's:

  • Add button to reset form in demo;
  • Hide popovers i.a. when windows is resizing;