Angular 5适用于ng服务但在maven安装期间中断

时间:2018-01-10 20:34:17

标签: java angular maven karma-jasmine yarn

运行Ng服务时应用程序运行正常但是当我运行运行构建的maven安装时,我得到以下错误

'app-comparisons' is not a known element:
[INFO]  1. If 'app-comparisons' is an Angular component, then verify that it is part of this module.
[INFO]  2. If 'app-comparisons' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
[INFO]                      </table>
[INFO]                  </div>
[INFO]                [ERROR ->]<app-comparisons></app-comparisons>
[INFO]              </div>
[INFO]              <div id="goals-2" class="spot-tabs__content">

我的html与my.ts

中的选择器相同

这是组件, comparisons.component.ts

import { Component, OnInit } from '@angular/core';
import {ComparisonsService} from '../services/comparisons.service';
import {Region} from '../models/region';
import {VetCount} from '../models/vetcount';

@Component({
  selector: 'app-comparisons',
  templateUrl: './comparisons.component.html',
  styleUrls: ['./comparisons.component.scss']
})
    export class ComparisonsComponent implements OnInit {
    regions: Region [];
    vetcounts: VetCount [];
    similarCount = 245;
    constructor(private comparisonsService: ComparisonsService) { }
    ngOnInit() {
      this.getRegions();
      this.getVetCounts();
    }
    getRegions(): void {
    this.regions = this.comparisonsService.getRegions();
    }
    getVetCounts(): void {
    this.vetcounts = this.comparisonsService.getVetCounts();
    }
}

最后这是我的 app.module.ts ,其中导入并声明了我的组件。我不确定我错过了什么。

import { ComparisonsComponent } from './comparisons/comparisons.component';
@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    HomeComponent,
    VdcComponent,
    PracticeComponent,
    IconComponent,
    ComparisonsComponent,
    GoalsComponent,
    ReportsComponent,
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,
    routing,
    ChartsModule,
  ],
  providers: [
    AuthGuardService,
    AuthenticationService,
    DataRequestService,
    ComparisonsService,
    ReportsService,
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

同样,应用程序在本地运行ng服务时运行良好,但很快就会进行mvn安装,并且它开始运行Yarn和karma测试,它会因为该错误而中断。

0 个答案:

没有答案