Skip to content

Instantly share code, notes, and snippets.

@CullenShane
Created April 7, 2015 22:22
Show Gist options
  • Save CullenShane/ebe103df0790a0d86262 to your computer and use it in GitHub Desktop.
Save CullenShane/ebe103df0790a0d86262 to your computer and use it in GitHub Desktop.
Fix angular-placeholder in IE9 when the input is required.
angular.module('apruve.checkout.util').directive 'required', ->
priority: 1
restrict: 'A'
require: '?ngModel'
link: (scope, elm, attr, ctrl) ->
return if !ctrl
origRequired = ctrl.$validators.required
ctrl.$validators.required = (modelValue, viewValue) ->
return !(viewValue == attr.placeholder) and origRequired(modelValue, viewValue)
attr.$observe 'required', ->
ctrl.$validate()
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment