Skip to content

Live Feedback: on success

nelsonomuto edited this page Feb 6, 2014 · 4 revisions

success is an optional property of the validation type object.

assign a function with the following signature:

function(value, validationAttributeValue, $element, model, ngModelController, $scope){
 //TODO: perform your on success action here
}

{
    customValidationAttribute: 'validationConfirmPassword',
    success: function(value, validationAttributeValue, $element, model, ngModelController, $scope){
        $element.addClass('PasswordSuccessCls');
    },
    errorMessage: 'Passwords do not match.',
    validator: function (errorMessageElement, val, attr, element, model, modelCtrl) {
         return model.password.trimRight() === element.val().trimRight();
    }
}