options

function in module validity

options(settings);

Configure angular-validity's global option settings

Parameters

ParamTypeDetails
settings
(optional)
objectSee Settings for a list of valid settings

Settings

SettingTypeDetailsDefault
cachebooleanWhen angular-validity is called to validate a form, it traverses the DOM for the inputs that need to be validated. Caching these inputs once they are found makes subsequent validation calls significantly fastertrue
debugbooleanEnable health checks on your angular-validity implementation. Reports are logged to the console at runtimefalse
eventstringThe default validation event an input should bind to when not specified within the validity directive.

Supported events: any standard DOM event (e.g., "blur", "change"). When using "watch", validation is triggered when the input's ng-model changes.
blur
stylestringBuilt in support for framework validation styles. Supported frameworks: "Bootstrap3"null

Returns

  • options - when a parameter is not passed into the function, it returns the existing options object
  • validity - when a parameter is passed into the function, it returns the validity module (for chaining)

Usage

Call from within your project module's config method:

angular.module("exampleApp", ["ttValidity"])

.config(["validityProvider", function (validityProvider) {
    validityProvider.options({
        // options
    });
}]);

Examples

Example 01: debug and style

validityProvider.options({
    debug: true,
    style: "Bootstrap3"
});