In my Angular Drag and Drop drop list, I want to pass an additional argument to the "[cdkDropListEnterPredicate]" function. By default it sends a CdkDrag and CdkDropList, but I have several drop lists so I only want one enter predicate function for them all. Here is my .html file:
<div class="players" [cdkDropListEnterPredicate]="filledPosition(drag, drop, '1')"
cdkDropList #fwdLine1="cdkDropList" [cdkDropListData]="f1"
[cdkDropListConnectedTo]="[forwardPlayers]"
(cdkDropListDropped)="drop($event)">
<div *ngFor="let fwd of f1" cdkDrag [cdkDragData]="fwd">
<div class="player">
<span>{{fwd.number}} {{fwd.name}} {{fwd.position}}</span>
</div>
</div>
</div>
And here is the function in the .ts file:
filledPosition = (item: CdkDrag<Skater>, list: CdkDropList, line) => {
if (line == "1") checkLine = this.f1;
console.log(item, list, line)
if (checkLine.length >= 3) {
return false;
}
return true;
}