Skip to content

Instantly share code, notes, and snippets.

@JasonHewison
Created July 2, 2015 14:16
Show Gist options
  • Save JasonHewison/1c660c6e320da5838d91 to your computer and use it in GitHub Desktop.
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">
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