I've an ng-repeat in my angular template which needs to be sortable. I'm using jQuery-ui's Sortable to implement it.
The JS:
$scope.data = [{"key":123,"val":"a"},
{"key":124,"val":"b"},
{"key":125,"val":"c"}];
$(".sortable").sortable();
The template:
<div class="sortable">
<div ng-repeat="sub in data" >
{{sub.key}}
</div>
</div>
This works perfectly fine, and I can drag and drop the elements. However, when a ng-repeat is nested within another, it doesn't work; I'm unable to drag anything. On using Chrome inspector, I see that the class 'ui-sortable' is not added to any element at all.
The JS:
$scope.subJson = [{"name":"MS1","slides":[{"title":"Title1"},{"title":"Title2"}]},{"name":"MS2","slides":[{"title":"Title3"},{"title":"Title4"}]}];
$(".sortable").sortable();
The template:
<div>
<div ng-repeat="sub in subJson" >
{{sub.name}}
<div class="sortable">
<div ng-repeat="slide in sub.slides" >
{{slide.title}}
</div>
</div>
</div>
</div>
Why does this happen? Is there a solution?