Disabling form validation

后端 未结 5 1511
暗喜
暗喜 2020-12-20 13:32

Angularjs is running my forms through the FormController (eg tracking pristine, dirty, etc). I don\'t need this functionality; I\'m sure it\'s add

5条回答
  •  感动是毒
    2020-12-20 14:13

    Internally Angular creates factories out of directives by adding the Directive suffix to the directive name. So you can replace the validation and input directive factories with no-operational ones.

    var noopDirective = function() { return function () {}; };
    angular.module('myModule')
        .factory('requiredDirective', noopDirective)
        .factory('ngRequiredDirective', noopDirective)
        .factory('inputDirective', noopDirective)
        .factory('textareaDirective', noopDirective); // etc...
    

提交回复
热议问题