【发布时间】:2017-05-02 04:34:52
【问题描述】:
我试图阻止用户移动dragulaService 的第一个元素,代码第一次运行没有任何错误,但是当我离开这个页面然后再次打开它时,我得到了错误。
导致错误的代码:
constructor(public service:SmartTablesService, private dragulaService:DragulaService) {
dragulaService.setOptions('nested-bag', {
revertOnSpill: true,
moves: function (el:any, container:any, handle:any):any {
if (handle.className === 'sorting-table-title') {
return false;
} else {
return true;
}
}
});
错误是:
error_handler.js:48 例外:未捕获(在承诺中):错误:./SortTableComponent 类 SortTableComponent_Host 中的错误 - 内联模板:0:0 导致:包名为:“nested-bag”已存在。 错误:包名为:“nested-bag”已经存在。 在 DragulaService.add (http://platform.local:8080/3.chunk.js:1070:19) 在 DragulaService.setOptions (http://platform.local:8080/3.chunk.js:1099:24) 在新的 SortTableComponent (http://platform.local:8080/3.chunk.js:1311:24)
【问题讨论】:
标签: angular drag-and-drop ng2-dragula