I'm trying to implement an AngularJS plugin into my application, but I can't really get it to work properly. I might be doing something wrong.
I have two panels that are sortable. I can swap their positions only once. After that they won't swap places anymore.
Here is an example of my problem: http://plnkr.co/edit/44fN6h6VyIft7j7bvs4j?p=preview
Anyone any idea what the problem is and how I can fix this issue?
Plnkr code (complete code in example):
<button type="button" ng-click="addItem('item1.html');">Add item 1</button>
<button type="button" ng-click="addItem('item2.html');">Add item 2</button>
<div ui-tree class="dd">
<ol ui-tree-nodes ng-model="list.items" class="dd-list">
<li ui-tree-node class="dd-item dd3-item" ng-repeat="element in list.items track by $index">
<div class="panel panel-default">
<div class="panel-heading clearfix">
Heading
</div>
<div id="settings-body{{$index}}" class="panel-body" data-nodrag>
<ng-include src="element.name"></ng-include>
</div>
</div>
</li>
</ol>
</div>
App.js
var app = angular.module('plunker', ['ui.tree']);
app.controller('MainCtrl', function($scope) {
$scope.list = {};
$scope.list.items = [];
$scope.addItem = function(name) {
$scope.list.items.push({name: name});
}
});