'ng-waveform' 不是 angular 中的已知元素

'ng-waveform' is not a known element in angular

我正在尝试使用 ng-waveform

Link: https://www.npmjs.com/package/ng-waveform

app.module文件中添加

import { NgWaveformModule } from 'ng-waveform';

在导入部分

imports: [  
    NgWaveformModule,
  ],

在我的ts file中包含

import { ITimeUpdateEvent, NgWaveformComponent, IRegionPositions } from 'ng-waveform';

export class WaveComponent implements OnInit {

  @ViewChild('waveform', { static: false }) waveform: NgWaveformComponent;

html Component 添加

 <ng-waveform #waveform class="waveform"
                                                [src]="src"
                                                [height]="150"
                                                [useRegion]="true"
                                                backgroundColor="#d3d3d3"
                                                regionBackgroundColor="rgba(255, 255, 255, 0.7)"
                                                regionStartStickColor="#21f032"
                                                regionEndStickColor="red"
                                                regionTextColor="#09417e"
                                                [withRegionLabels]="true"
                                                waveColor="#ff11ff"
                                                (trackLoaded)="onTrackLoaded($event)"
                                                (rendered)="onTrackRendered($event)"
                                                (durationChange)="onDurationChange($event)"
                                                (timeUpdate)="onTimeUpdate($event)"
                                                (paused)="onPaused()"
                                                (regionChange)="onRegionChange($event)"
                                              >

但仍然得到

'ng-waveform' is not a known element:

  1. If 'ng-waveform' is an Angular component, then verify that it is part of this module.
  2. If 'ng-waveform' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

解决此问题的任何解决方案谢谢

您可能忘记在模块中添加 WaveComponent

@NgModule({
  imports: [BrowserModule, FormsModule, NgWaveformModule],
  declarations: [
   ....
   WaveComponent // don't forget to declare your components 
 ],
  bootstrap: [AppComponent],
})
export class AppModule {}