bevacqua / angularjs-dragula

:ok_hand: Drag and drop so simple it hurts
https://bevacqua.github.io/angularjs-dragula
MIT License
509 stars 109 forks source link

Dynamic bag name #48

Open clark-ajf opened 8 years ago

clark-ajf commented 8 years ago

I'm trying to create dynamics names to avoid the Multiple Directives error, but with the double quotes used in the bag name the value is interpreted as text even if I use {{}}

<h2>Activity</h2>
                      <div flex ng-cloak ng-repeat="module in modules">
                        <md-grid-list
                                md-cols="{{days.length}}" md-cols-sm="{{days.length}}" md-cols-md="{{days.length}}" md-cols-gt-md="{{days.length}}"
                                md-row-height-gt-md="1:1" md-row-height="1:1"
                                md-gutter="8px" md-gutter-gt-sm="4px" >
                            <md-grid-tile ng-repeat="day in days"
                                        md-rowspan="1"
                                        md-colspan="1"
                                        md-colspan-sm="1" ng-class="day.background" dragula='"{{"bag-" + day.name + "-" + module}}"'>
                            <!--<md-icon md-svg-icon="{{tile.icon}}"></md-icon>-->
                            <md-grid-tile-footer><h3>{{day.name}}</h3></md-grid-tile-footer>{{day.name}}
                            </md-grid-tile>
                        </md-grid-list>
                      </div>
mleanos commented 8 years ago

try this

dragula="'{{'bag-' + day.name + '-' + module}}'"
inigopascall commented 6 years ago

How would you then set options for this bag? at present I can use:

dragulaService.setOptions('first-bag', { moves: function (el, container, handle) { return handle.className === 'handle'; } });

But what if we don't know the name of the bag at this time?