0

我有一个模式组件,它使用在我的共享模块中声明的指令。当我处于“开发模式”工作时,我没有任何错误,但是当我尝试编译它时,出现以下错误:

无法绑定到“剪贴板”,因为它不是“a”的已知属性

我的 sharedModule 应该将剪贴板指令导出到我的 entryComponent LogsModalComponent?

我的共享模块

@NgModule({
  declarations: [
    ...
    ClipboardDirective
  ]
  ,
  imports: [
    FormsModule
  ],
  exports: [
    ClipboardDirective
  ]

})
export class SharedModule {
}

和我的 entryComponent 的另一个模块,称为 LogsModalModule

@NgModule({
  imports: [
    ....
    SharedModule
  ],
  declarations: [LogsModalComponent],
  entryComponents: [LogsModalComponent]
})
export class LogsModalModule { }

LogsModalComponent

<a [clipboard]="log.responseBody"
            triggers="click" >
          </a>

我以这种方式使用我的模态

export class OrderDetailsInfoComponent implements OnInit, OnChanges {
  constructor(..., private modalService: NgbModal) {}

  someFunction() {
   this.modalService.open(LogsModalComponent, { size: 'lg' });
  }
}

声明 OrderDetailsInfoComponent 的模块

@NgModule({
  imports: [
    CommonModule,
    TranslateModule.forChild(),
    SharedModule,
    ],
  declarations: [
    OrderDetailsInfoComponent
  ],
  exports: [OrderDetailsInfoComponent],
  providers: [],
  bootstrap: []
})
export class OrderDetailsInfoModule { }

包.json

{
  "dependencies": {
    "@ng-bootstrap/ng-bootstrap": "^5.2.1",
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.25",
    "@angular/cli": "^8.3.25",
    "@angular/compiler-cli": "^8.2.14",
    "@angular/core": "^8.2.14",
    "@angular/language-service": "^8.2.14"
  }
}
4

0 回答 0