diff --git a/src/bootstrap/choices.tpl.html b/src/bootstrap/choices.tpl.html
index b0ef81bdb..edabce9f0 100644
--- a/src/bootstrap/choices.tpl.html
+++ b/src/bootstrap/choices.tpl.html
@@ -4,7 +4,7 @@
-
diff --git a/src/select2/choices.tpl.html b/src/select2/choices.tpl.html
index f462dab92..cd9fb930e 100644
--- a/src/select2/choices.tpl.html
+++ b/src/select2/choices.tpl.html
@@ -3,7 +3,7 @@
diff --git a/test/select.spec.js b/test/select.spec.js
index cd95af1c3..d44a25e18 100644
--- a/test/select.spec.js
+++ b/test/select.spec.js
@@ -399,6 +399,23 @@ describe('ui-select tests', function() {
expect(getMatchLabel(el)).toEqual('Samantha');
});
+ it('should correctly render initial state with track by $index', function () {
+
+ var el = compileTemplate(
+ ' \
+ {{$select.selected.name}} \
+ \
+ {{person.email}} \
+ \
+ '
+ );
+
+ openDropdown(el);
+
+ var generatedId = el.scope().$select.generatedId;
+ expect($(el).find('[id="ui-select-choices-row-' + generatedId + '-0"]').length).toEqual(1);
+ });
+
it('should utilize wrapper directive ng-model', function() {
var el = compileTemplate('');
scope.selection.selected = { name: 'Samantha', email: 'something different than array source', group: 'bar', age: 30 };