File: /var/www/html/assets/js/angular/directives/customSelectbox.js
(function() {
if (typeof App !== "undefined" && App !== null) {
App.directive('customSelectbox', function() {
return {
restrict: 'A',
link: function(scope, elem, attr) {
var obj, set_selectbox;
jQuery(elem).wrap('<div class="selectcustom"></div>').before('<div class="inner"><span></span><i class="fa fa-chevron-down"></i></div>');
obj = jQuery('.inner', elem);
set_selectbox = function() {
var selected
var value;
selected = scope.$eval(attr.ngModel);
if (jQuery(this).find('option:selected')[0]) {
value = jQuery(this).find('option:selected').text();
} else {
value = jQuery(this).find('option:first-child').text();
}
return jQuery(this).siblings(obj).find('span').html(value);
};
jQuery(elem).each(set_selectbox).on('change', set_selectbox);
}
};
});
}
}).call(this);