小编Pau*_*l B的帖子

当两个 Angular 库存在属性名称冲突时我该怎么办?

我正在使用两个库编写一个角度应用程序:ngx-bootstrap 和 ng-apexcharts。ApexCharts 提供了一个名为 的角度分量,它接受类型为 的<apx-chart>输入。html 看起来像这样:tooltipApexTooltip

  <apx-chart 
    [series]="[{data: timelineData}]"
    [chart]="timeline.chart"
      [fill]="timeline.fill"
      [legend]="timeline.legend"
      [plotOptions]="timeline.plotOptions"
      [xaxis]="timeline.xaxis"
      [colors]="timeline.colors"
      [title] = "timeline.title"
      [tooltip]="timeline.tooltip"
      [yaxis] = "timeline.yaxis"
   ></apx-chart>
Run Code Online (Sandbox Code Playgroud)

以下是角度顶点图表文档的链接:https ://apexcharts.com/docs/angular-charts/

ngx-bootstrap 提供了一个名为的模块TooltipModule,当导入到应用程序模块中时,允许您在任何元素上放置tooltip属性,并且当用户将鼠标悬停在该元素上时,它将创建一个工具提示。看起来是这样的:

  <button type="button" class="btn btn-default btn-secondary mb-2"
      tooltip="Vivamus sagittis lacus vel augue laoreet rutrum faucibus.
      placement="top">
    Tooltip on top
  </button>
Run Code Online (Sandbox Code Playgroud)

以下是 ngx-bootstrap 工具提示文档的链接:https://valor-software.com/ngx-bootstrap/#/tooltip

我试图一起使用这两个库,但是当我将工具提示模块添加到应用程序模块导入中时,出现编译错误。

@NgModule({
  imports: [
    BrowserModule,
    TooltipModule.forRoot(),
    ...
  ]
...
Run Code Online (Sandbox Code Playgroud)
Error: src/app/activity-report/details/details.component.html:52:8 - error TS2322: Type 'ApexTooltip' is not assignable to …
Run Code Online (Sandbox Code Playgroud)

name-conflict property-binding ngx-bootstrap angular apexcharts

6
推荐指数
1
解决办法
263
查看次数