Search code examples
angularjsvalidationangular-ui-bootstrapui-validate

ui-validate doesn't get called


I have an input element (actually a datepicker) with the following attribute:

ui-validate="{ customValidation: 'validateDate(vm.dob)' }"

In my javascript I have the following method on my scope:

$scope.validateDate = function(val) {
    $scope.vm.showValidation = true;
    return false;
}

However the vm.showValidation variable isn't getting updated.

Here's a CodePen with an example of my problem.

I'm using :-

angular 1.6.1

angular-ui-bootstrap 0.11 (old)

angular-ui-validate 1.2.2


Solution

  • You forgot to add ui.validate injection into your application module - CodePen. Unless you are not able to use the ui-validate directive.

    var app = angular.module("app", ['ui.bootstrap', 'ui.validate']);