I use drag&drop via ng2-dragula. The drag&drop functionality is applied this way:
<div class='container' [dragula]='"first-bag"'>
<div>item 1</div>
<div>item 2</div>
</div>
If I understand angular 2 properly, the way how [dragula]='"first-bag"'
is attached to my div is called Attribute Directive in Angular 2.
Now I have a variable in my component called enableDragNDrop:boolean
. How can I use this variable to attach [dragula]='"first-bag"'
to my div only when enableDragNDrop == true
?
If enableDragNDrop == false
, i want this:
<div class='container'><!-- no dragula attribute directive, no dragndrop -->
<div>item 1</div>
<div>item 2</div>
</div>