Skip to content

Instantly share code, notes, and snippets.

@mahmut-gundogdu
Created July 10, 2017 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahmut-gundogdu/ac58c34c093e8b0dfdfbbf5055133523 to your computer and use it in GitHub Desktop.
Save mahmut-gundogdu/ac58c34c093e8b0dfdfbbf5055133523 to your computer and use it in GitHub Desktop.
angular js select2 model değiştiğinde jquery plugininin kendini refresh etmesini sağlayan kodumuz.
angular
.module('myapp',[])
.directive('select2refresh', function () {
return {
restrict: 'A',
scope: {
'ngModel': '='
},
link: function (scope, element, attrs) {
scope.$watch('ngModel', function (newValue, oldValue) {
$(element).trigger('change.select2');
});
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment