首页 > 解决方案 > SignaturePad:出现在 AppModule 的 NgModule.imports 中,但无法解析为 NgModule 类

问题描述

我目前正在研究一个前一段时间已经制作的角度工作空间,但多年来一直没有修改或更新。现在我必须处理它,有一个我无法构建的项目,在构建命令之后给了我标题错误。我已经尝试了所有我能想到的方法:重新运行 npm install、重新安装节点、重新安装 angular,但没有。我认为它可能是这样的,因为我正在使用的 SignaturePad 库(angular2-signature)看起来不再受支持,但即使这是软件应该工作的问题,对吧?

app.module.ts:

import { Helper } from './shared/helper';
import { FaceDetectionService } from './services/face-detection-service';
import { DossierService } from './services/dossier.service';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
import { HttpClientModule } from '@angular/common/http';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ExpertComponent } from './components/expert/expert.component';
import { ClientComponent } from './components/client/client.component';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { FirebaseService } from './services/firebase.service';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule, FirestoreSettingsToken } from '@angular/fire/firestore';
import { SignaturePad } from 'angular2-signaturepad'
import { VideoPeriziaComponent } from './components/video-perizia/video-perizia.component';
import { ExpertInfoComponent } from './components/expert-info/expert-info.component';
import { ImageService } from './services/image.service';
import { PriceAgreementComponent } from './components/price-agreement/price-agreement.component';
import { MatDialogModule, MatInputModule } from '@angular/material';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { ReportService } from './services/report.service';
import { NgxAgoraModule } from 'ngx-agora';
import { environment } from '../../src/environments/environment';
import { SdUiLibraryModule } from 'projects/sd-ui-library/src/public-api';
import { AllowShootingDialogComponent } from './components/allow-shooting-dialog/allow-shooting-dialog.component';
import { AGORA_CONFIG } from './shared/constants';
import { ElementaryBranchesCardComponent } from './components/elementary-branches-card/elementary-branches-card.component';

@NgModule({
  declarations: [
    AppComponent,
    ExpertComponent,
    ClientComponent,
    VideoPeriziaComponent,
    ExpertInfoComponent,
    PriceAgreementComponent,
    AllowShootingDialogComponent,
    ElementaryBranchesCardComponent
  ],
  imports: [
    ToastrModule.forRoot({timeOut: 3000, positionClass: 'toast-top-left'}),
    AngularFireModule.initializeApp(environment.firebase),
    NgxAgoraModule.forRoot(AGORA_CONFIG),
    AngularFirestoreModule,
    BrowserModule,
    BrowserAnimationsModule,
    FormsModule,
    SignaturePad,
    AppRoutingModule,
    HttpClientModule,
    FontAwesomeModule,
    SdUiLibraryModule,
    MatDialogModule,
    MatCheckboxModule,
    MatInputModule,
  ],
  providers: [
    DossierService,
    FirebaseService,
    FaceDetectionService,
    ImageService,
    ReportService,
    Helper,
    { provide: FirestoreSettingsToken, useValue: {} }
],
  bootstrap: [AppComponent],
  entryComponents: []
})
export class AppModule { }

签名板组件

import { AfterContentInit, ElementRef, EventEmitter, OnDestroy } from '@angular/core';
import * as ɵngcc0 from '@angular/core';
export interface Point {
    x: number;
    y: number;
    time: number;
}
export declare type PointGroup = Array<Point>;
export declare class SignaturePad implements AfterContentInit, OnDestroy {
    options: any;
    onBeginEvent: EventEmitter<boolean>;
    onEndEvent: EventEmitter<boolean>;
    private signaturePad;
    private elementRef;
    constructor(elementRef: ElementRef);
    ngAfterContentInit(): void;
    ngOnDestroy(): void;
    resizeCanvas(): void;
    toData(): Array<PointGroup>;
    fromData(points: Array<PointGroup>): void;
    toDataURL(imageType?: string, quality?: number): string;
    fromDataURL(dataURL: string, options?: any): void;
    clear(): void;
    isEmpty(): boolean;
    off(): void;
    on(): void;
    set(option: string, value: any): void;
    onBegin(): void;
    onEnd(): void;
    queryPad(): any;
    static ɵfac: ɵngcc0.ɵɵFactoryDef<SignaturePad, never>;
    static ɵcmp: ɵngcc0.ɵɵComponentDefWithMeta<SignaturePad, "signature-pad", never, { "options": "options"; }, { "onBeginEvent": "onBeginEvent"; "onEndEvent": "onEndEvent"; }, never, never>;
}

标签: angularsignaturepad

解决方案


推荐阅读