marceljuenemann / angular-drag-and-drop-lists

Angular directives for sorting nested lists using the HTML5 Drag & Drop API
MIT License
2.16k stars 713 forks source link

Nothing render #345

Closed desatir7316 closed 7 years ago

desatir7316 commented 7 years ago

I used exactly the same code in simple and other example but it renders nothing. For example this is the code for simple example: JS:

`$scope.models = { selected: null, lists: {"A": [], "B": []} };

    // Generate initial model
    for (var i = 1; i <= 3; ++i) {
        $scope.models.lists.A.push({label: "Item A" + i});
        $scope.models.lists.B.push({label: "Item B" + i});
    }

    // Model to JSON for demo purpose
    $scope.$watch('models', function(model) {
        $scope.modelAsJson = angular.toJson(model, true);
    }, true);

`

HTML:

`

` And finally it renders this. ``
keithmichelson commented 7 years ago

The sample code is wrong.

In the html, "list" should be "models.lists"

ghost commented 7 years ago

Still nothing is rendering

marceljuenemann commented 7 years ago

The sample code is only for one list, while the JavaScript snippet generates the models for all lists. I recommend you to not copy & paste any code, you will not understand how a library works that way. Instead, start by coding a non-draggable list the way you want it in your application. Once you can see it on screen, start adding a dnd-draggable tag, and next a dnd-list.