0
votes

I want to include or not a directive in my div depending on a boolean value, but I can't find how to do it.

The directive is dnd-sortable-container for ng2-dnd library:

<div ng-dnd-sortable-container="booleanValue ? true : null"> //html
booleanValue: boolean //ts

but it does nothing.

how can I do it?

1

1 Answers

0
votes

There is no way (as far as I know) to apply directives conditionally. But you can render a div with or without directive based on a condition:

<div *ngIf"booleanValue; else noDirective" ng-dnd-sortable-container>
</div>

 <ng-template #noDirective>
  <div></div>
 </ng-template>