Created
March 18, 2016 13:31
-
-
Save dimaShin/8b2994c6fa4ce35f94a5 to your computer and use it in GitHub Desktop.
ngFormController decorator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(function (ng) { | |
FormControllerDecorator.$inject = ['$delegate', 'Helpers']; | |
function FormControllerDecorator ($delegate, helpers) { | |
const ngForm = $delegate[0]; | |
const FormController = ngForm.controller; | |
FormController.prototype._errorMessages = helpers.errorMessages; | |
FormController.prototype._showError = modelController => { | |
if (modelController.$valid) { | |
return false; | |
} | |
return modelController.$dirty || modelController.$touched; | |
}; | |
return $delegate; | |
} | |
ng.module('investum').decorator('ngFormDirective', FormControllerDecorator); | |
}(window.angular)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment