Angular cdkDropListSortingDisabled属性可以';因为它';是cdkDropList指令的未知属性。角制导武器

Angular cdkDropListSortingDisabled属性可以';因为它';是cdkDropList指令的未知属性。角制导武器,angular,angular-material2,angular-directive,angular-cdk,angular-dragdrop,Angular,Angular Material2,Angular Directive,Angular Cdk,Angular Dragdrop,所以我想实现一个用例,我想通过拖放将一些数据从一个区域(div)复制到另一个区域,我在网上冲浪发现angular/material2可以通过使用cdkDropList API来完成这项工作。 我用angular/material2提供的copyArrayitem函数实现了,它完成了工作,从知道开始一切都很好。 问题是,droplist总是被排序,而我希望我的可拖动组件在DropZone内自由移动,但是cdkDropList强制在zone中进行排序。 所以我开始在互联网上搜索得到一些解决方案,我发


所以我想实现一个用例,我想通过拖放将一些数据从一个区域(div)复制到另一个区域,我在网上冲浪发现angular/material2可以通过使用cdkDropList API来完成这项工作。 我用angular/material2提供的copyArrayitem函数实现了,它完成了工作,从知道开始一切都很好。 问题是,droplist总是被排序,而我希望我的可拖动组件在DropZone内自由移动,但是cdkDropList强制在zone中进行排序。
所以我开始在互联网上搜索得到一些解决方案,我发现一些博客谈论cdkDrop指令组件,但我猜它没有得到支持,因为我在angular/material2的GitHub repo中没有找到该组件(cdkDrop)的任何开源代码,相反,我在cdkDropList指令中发现了一些关于cdkDropListSortingDisabled属性的问题,您可以参考以清楚地理解我所说的内容,尤其是在这些行中

@Input('cdkDropListSortingDisabled') get sortingDisabled(): boolean { 
    return this._sortingDisabled; 
}
set sortingDisabled(value: boolean) {
    this._sortingDisabled = coerceBooleanProperty(value);
}
知道Angle material Officel网站()不提供此属性。 问题是,是否有任何可能的解决方案可以直接从angular GitHub存储库使用此属性?
我尝试使用此行命令将分支作为依赖项添加到我的package.json中

npm安装-保存角度/材料2#主 但npm无法解决此错误
npm错误!代码失效循环
npm错误!错误1
npm错误!材料2-srcs@7.3.4预安装:node./tools/npm/check npm.js
npm错误!退出状态1
npm错误
npm错误!在材质2处失败-srcs@7.3.4预安装脚本。
npm错误!这可能不是npm的问题。上面可能还有其他日志输出。

或者有不同的解决方案来禁用cdkDropList中的排序?或者执行此实现?。 注意:角度版本7
尽管我的英语水平很高,但我还是希望能接受这个想法。
感谢您的帮助(博客或答案)

致以最诚挚的问候。

您可以将其作为属性直接传递到html:

<div
    cdkDropList
    [cdkDropListData]="imgFiles"
    [cdkDropListDisabled]="true"
    class="image-list"
    [cdkDropListOrientation]="listOrientation"
    (cdkDropListDropped)="drop($event)">
    <div class="image-box" [ngClass]="{'mobile-full-img': !originalData.only}" cdkDrag *ngFor="let item of imgFiles">
      <mat-checkbox *ngIf="!originalData.only" color="primary" (dblclick)="checkItmIE(item)" [(ngModel)]="item.checked"></mat-checkbox>
      <img [src]="item.src">
      <div class="spinner-wrapper" *ngIf="!item.done">
        <div class="spin"></div>
      </div>
      <span class="success-check-span" *ngIf="item.done && !item.stopStatusFeedback">
        <i class="fas fa-check-circle"></i>
      </span>
    </div>
  </div>