Created
July 2, 2015 14:16
-
-
Save JasonHewison/1c660c6e320da5838d91 to your computer and use it in GitHub Desktop.
Fix angularjs model binding issue in IE10 when clicking on the clear (X) button in an <input type="text">
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
angular.module('mymodule') | |
.directive('input', function () { | |
'use strict'; | |
return { | |
restrict: 'E', | |
link: function (scope, element, attrs) { | |
if ((attrs.type + '').toLowerCase() !== 'text') { | |
return; | |
} | |
element[0].oninput = function () { | |
element.triggerHandler('change'); | |
}; | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment