Skip to content

Instantly share code, notes, and snippets.

@ValdasK
Last active August 29, 2015 14:13
Show Gist options
  • Save ValdasK/cb8ee518f481bb4ed506 to your computer and use it in GitHub Desktop.
Save ValdasK/cb8ee518f481bb4ed506 to your computer and use it in GitHub Desktop.
AngularJS directive to fix autocomplete (without jQuery)
(function() {
angular
.module('xApp')
.directive('triggerChange', triggerChangeDirective);
function triggerChangeDirective() {
return {
restrict: 'A',
priority: -10,
link: function (scope, element) {
element.on('submit', function(){
angular.forEach(element.find('input'), function(field) {
angular.element(field).triggerHandler('change');
});
});
}
};
}
})();
@ValdasK
Copy link
Author

ValdasK commented Jan 14, 2015

Use like

<form trigger-change>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment