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

Allowed type with nested demo #423

Open florentplomb opened 7 years ago

florentplomb commented 7 years ago

Hello,

I'm trying to use the attribute "dnd-allowed-types" to the "Nested Containers demo" in order to have only item in container (no container in container) but I'm stuck.

I add an attribute "allowedTypes" in my templates like here: $scope.models = { selected: null, templates: [ {type: "item", id: 2}, {type: "container", id: 1, allowedTypes: ["item"], columns: [[]]} ], dropzones: { "A": [ ]}}

For the HTML can some body tell me where I have to put the "dnd-type" and "dnd-allowed-types" attribute? In the list.html? or container.html?

jaheraho commented 6 years ago

Hi there, you put dnd-allowed-types in the ul (where dnd-list defined) and put dnd-type in the li (where dnd-draggable is defined). dnd-allowed-types has to be an array of strings, dnd-type has to be an string (number leads to an error at the moment, until my pull request #468 is accepted)