diff --git a/bower.json b/bower.json
index fa48098e0..ba662c5d4 100644
--- a/bower.json
+++ b/bower.json
@@ -16,11 +16,11 @@
"test"
],
"dependencies": {
- "angular": "1.2.0 - 1.2.17"
+ "angular": "~1.2"
},
"devDependencies": {
"jquery": "~1.11",
- "angular-sanitize": "1.2.0 - 1.2.17",
- "angular-mocks": "1.2.0 - 1.2.17"
+ "angular-sanitize": "~1.2",
+ "angular-mocks": "~1.2"
}
}
diff --git a/examples/demo.html b/examples/demo.html
index 006f7da53..dad80fc06 100644
--- a/examples/demo.html
+++ b/examples/demo.html
@@ -18,8 +18,8 @@
-
-
+
+
diff --git a/src/bootstrap/choices.tpl.html b/src/bootstrap/choices.tpl.html
index a3c014978..472dd8549 100644
--- a/src/bootstrap/choices.tpl.html
+++ b/src/bootstrap/choices.tpl.html
@@ -2,6 +2,6 @@
role="menu" aria-labelledby="dLabel"
ng-show="$select.items.length > 0">
-
+
diff --git a/src/select.js b/src/select.js
index a5065c39f..8936798ee 100644
--- a/src/select.js
+++ b/src/select.js
@@ -380,8 +380,8 @@ angular.module('ui.select', [])
}])
.directive('uiSelectChoices',
- ['uiSelectConfig', 'RepeatParser', 'uiSelectMinErr',
- function(uiSelectConfig, RepeatParser, uiSelectMinErr) {
+ ['uiSelectConfig', 'RepeatParser', 'uiSelectMinErr', '$compile',
+ function(uiSelectConfig, RepeatParser, uiSelectMinErr, $compile) {
return {
restrict: 'EA',
@@ -396,17 +396,27 @@ angular.module('ui.select', [])
compile: function(tElement, tAttrs) {
var repeat = RepeatParser.parse(tAttrs.repeat);
+ return function link(scope, element, attrs, $select, transcludeFn) {
+
+ var rows = element.querySelectorAll('.ui-select-choices-row');
+ if (rows.length !== 1) {
+ throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row but got '{0}'.", rows.length);
+ }
- var rows = tElement.querySelectorAll('.ui-select-choices-row');
- if (rows.length !== 1) {
- throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row but got '{0}'.", rows.length);
- }
+ rows.attr('ng-repeat', RepeatParser.getNgRepeatExpression(repeat.lhs, '$select.items', repeat.trackByExp))
+ .attr('ng-mouseenter', '$select.activeIndex = $index')
+ .attr('ng-click', '$select.select(' + repeat.lhs + ')');
- rows.attr('ng-repeat', RepeatParser.getNgRepeatExpression(repeat.lhs, '$select.items', repeat.trackByExp))
- .attr('ng-mouseenter', '$select.activeIndex = $index')
- .attr('ng-click', '$select.select(' + repeat.lhs + ')');
- return function link(scope, element, attrs, $select) {
+ transcludeFn(function(clone) {
+ var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');
+ if (rowsInner.length !== 1)
+ throw uiSelectMinErr('rows', "Expected 1 .ui-select-choices-row-inner but got '{0}'.", rowsInner.length);
+
+ rowsInner.append(clone);
+ $compile(element)(scope);
+ });
+
$select.parseRepeatAttr(attrs.repeat);
scope.$watch('$select.search', function() {
@@ -455,6 +465,6 @@ angular.module('ui.select', [])
}
return function(matchItem, query) {
- return query ? matchItem.replace(new RegExp(escapeRegexp(query), 'gi'), '$&') : matchItem;
+ return query && matchItem ? matchItem.replace(new RegExp(escapeRegexp(query), 'gi'), '$&') : matchItem;
};
});
diff --git a/src/select2/choices.tpl.html b/src/select2/choices.tpl.html
index fb4d56aeb..82ddea791 100644
--- a/src/select2/choices.tpl.html
+++ b/src/select2/choices.tpl.html
@@ -1,5 +1,5 @@
diff --git a/src/selectize/choices.tpl.html b/src/selectize/choices.tpl.html
index c504f636c..58a254f4c 100644
--- a/src/selectize/choices.tpl.html
+++ b/src/selectize/choices.tpl.html
@@ -2,7 +2,7 @@