callbacks
function in module validity
callbacks(settings);
callbacks(settings);
Change angular-validity's global callback settings
Parameters
Param | Type | Details |
---|---|---|
settings (optional) | object | See Settings for a list of valid settings |
Settings
Setting | Type | Details | Default |
---|---|---|---|
invalid | function | Called after each invalid validation check. The validated control is passed as a parameter | null |
valid | function | Called after each valid validation check. The validated control is passed as a parameter | null |
Returns
callbacks
- when a parameter is not passed into the function, it returns the existing callbacks objectvalidity
- 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.callbacks({
// callbacks
});
}]);
Examples
Example 01: valid callback
validityProvider.callbacks({
valid: function (control) {
control.$element.addClass("my-valid-class");
}
});
Example 02: valid and invalid callback
validityProvider.callbacks({
valid: function (control) {
control.$element.addClass("my-valid-class");
},
invalid: function (control) {
control.$element.addClass("my-invalid-class");
}
});
Updated less than a minute ago