From 46a3de9ac44c01ce97b8e13b25bbed5b5cd026de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Vollst=C3=A4dt?= Date: Thu, 13 Aug 2015 19:57:52 +0200 Subject: [PATCH] Integrated https://github.com/kamilkp/ng-nestable/pull/7 --- src/angular-nestable.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/angular-nestable.js b/src/angular-nestable.js index 415ab11..ea54211 100644 --- a/src/angular-nestable.js +++ b/src/angular-nestable.js @@ -192,6 +192,12 @@ function buildNestableHtml(model, tpl) { var root = $('
'); + // create placeholder if the list is empty + if (!model.length) { + $('
').appendTo(root); + return root; + } + // create nested hierarchy var rootList = $('
    ').appendTo(root); var draggableHandle = $nestable.enableDraggableHandle; model.forEach(function f(item){ @@ -253,4 +259,4 @@ } }; }]); -})(window, document, window.angular); \ No newline at end of file +})(window, document, window.angular);