Firt of all sorry for my englis.
I add my code for fix bug when there are several uiselect in the same template:
`//xeditable with ui-select
angular.module('xeditable').directive('editableUiSelect', ['editableDirectiveFactory',
function (editableDirectiveFactory) {
var rename = function (tag, el) {
var newEl = angular.element('<' + tag + '/>');
newEl.html(el.html());
var attrs = el[0].attributes;
for (var i = 0; i < attrs.length; ++i) {
newEl.attr(attrs.item(i).nodeName, attrs.item(i).value);
}
return newEl;
};
var match = [];
var choices = [];
var dir = editableDirectiveFactory({
directiveName: 'editableUiSelect',
inputTpl: '<ui-select></ui-select>',
render: function () {
this.parent.render.call(this);
//fix bug model update
this.inputEl.attr('ng-model', '$parent.$data');
this.inputEl.append(rename('ui-select-match', match[this.inputEl.attr('name')]));
this.inputEl.append(rename('ui-select-choices', choices[this.inputEl.attr('name')]));
}
});
var linkOrg = dir.link;
dir.link = function (scope, el, attrs, ctrl) {
var matchEl = el.find('editable-ui-select-match');
var choicesEl = el.find('editable-ui-select-choices');
match[attrs.eName] = matchEl.clone();
choices[attrs.eName] = choicesEl.clone();
matchEl.remove();
choicesEl.remove();
return linkOrg(scope, el, attrs, ctrl);
};
return dir;
}]);`
Firt of all sorry for my englis. I add my code for fix bug when there are several uiselect in the same template:
`//xeditable with ui-select angular.module('xeditable').directive('editableUiSelect', ['editableDirectiveFactory', function (editableDirectiveFactory) { var rename = function (tag, el) { var newEl = angular.element('<' + tag + '/>'); newEl.html(el.html()); var attrs = el[0].attributes; for (var i = 0; i < attrs.length; ++i) { newEl.attr(attrs.item(i).nodeName, attrs.item(i).value); } return newEl; };