3

I am new in angular-js. I am developing my app with angular-kendo. I followed

  1. http://kendo-labs.github.io/angular-kendo/#/Validator
  2. http://www.telerik.com/forums/angular-kendo-validator.

Before implement the in my real project I implement it in my text project. Look at my view:

 <form role="form" name="formTimeLine" kendo-validator="validator" 
 k-options="myValidatorOptions">
  <p>{{Welcome}}</p>
    <span class="label required">Name:</span>
      <input type="remarks" name="remarks" class="k-textbox" 
      ng-model="fiscalYear.Remarks" data-test="Please write sabbir."/><br>
       <span data-for='remarks' class='k-invalid-msg'></span>
      <button ng-click="Save()">Save</button>
  </form>

My validation rules in controller is:

  $scope.myValidatorOptions = {
    rules: {
        test: function (input) {
            if (input.is("[name=remarks]")) {

                return input.val() == "Sabbir"
            } else {
                return true;
            }
        }
    },
    messages: {
        test: "Your UserName must be Sabbir"
    }
  };

My save function is as follows:

   $scope.Save = function () {
    //$scope.formTimeLine.$valid
    if ($scope.validator.validate()) {
        alert("Saved");
    }
    else {
        alert("Error");
    }
};

How can I wire up a rule with kendo-validator so that remote validation will be called and validate? It is said to use custom directive and ctrl.$setValidity('unique', false); but calling $scope.validator.validate() return true.

halfer
  • 19,824
  • 17
  • 99
  • 186
user3352074
  • 145
  • 3
  • 14
  • maybee that can help =)
    , and in your controller define $scope.myRules and $scope.myMessages. http://www.telerik.com/forums/angular-kendo-validator
    – oCcSking Mar 04 '15 at 09:54

0 Answers0