执行NPM运行构建时会出现错误:我的Angular2应用程序的产品



当我进行NPM启动时,我的应用程序正常工作。但是,当尝试使用产品构建时-NPM运行构建:prod

它在编译的TS文件之一中丢了一个奇怪的错误。我不能明白为什么。

请帮助

JS文件的组件文件。

import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import { CompetitionService } from '../shared/competition.service';
@Component({
  selector:'competitiontable',
  styleUrls:['table.component.css'],
  templateUrl:'table.component.html' //or use absoulte path with templateUrl:'app/competition/competition.component.html'require('./table.component.html')
})
export class TableComponent implements OnInit{
    constructor(private competitionService:CompetitionService,private route:ActivatedRoute,private router: Router) {
    }
      competitionId:string;
      competitionTeams:any;
      teamId:string;
      //groupComptetitionTeams:any;
      visibleLeague:boolean;
      visibleTournament:boolean;
    ngOnInit(){
      this.competitionId = this.route.snapshot.params['id'];
      console.log("competition ID"+this.competitionId);
      this.getTeams();
    }
    getTeams(){
      this.competitionService.getTeams(this.competitionId).subscribe(teams => {
                                                                if(teams.standing){
                                                                  this.visibleLeague = true;
                                                                  this.visibleTournament = false;
                                                                  return this.competitionTeams = teams.standing;
                                                                }else{
                                                                  this.visibleLeague = false;
                                                                  this.visibleTournament = true;
                                                                  return this.competitionTeams = teams.standings;
                                                                }
      });
      //this.competitionService.getTeams(this.competitionId).subscribe(teams => (this.groupComptetitionTeams = teams.standings));

    }
    onSubmit(team:any){
      this.teamId = team._links.team.href.split('/').pop(-1);
      this.competitionService.storeTeamCrest(team.crestURI);
      this.router.navigate(['team', {id: this.teamId}]);
    }

}

TS文件中的错误行。coudnt粘贴整个JS,因为它很大

 detectChangesInternal(throwOnChange:boolean):void {
    const valUnwrapper:any = new import13.ValueUnwrapper();
    valUnwrapper.reset();
    const currVal_4_0_0:any = valUnwrapper.unwrap(import3.castByValue(this._pipe_keys_0_0,(<View_TableComponent0>this.parentView)._pipe_keys_0.transform)(this.parentView.context.competitionTeams)); // this is the error line
    this._NgFor_4_6.check_ngForOf(currVal_4_0_0,throwOnChange,valUnwrapper.hasWrappedValue);
    this._NgFor_4_6.ngDoCheck(this,this._anchor_4,throwOnChange);
    this._vc_4.detectChangesInNestedViews(throwOnChange);
  }

构建时,控制台中的错误

[at-loader] Checking finished with 1 errors
Error in bail mode: [at-loader] compiledsrcapptabletable.component.ngfactory.ts:530:51
    TS2346: Supplied parameters do not match any signature of call target.

管道

import { PipeTransform, Pipe } from '@angular/core';
@Pipe({name: 'keys'})
export class KeysPipe implements PipeTransform {
  transform(value, args:string[]) : any {
    let keys = [];
    for (let key in value) {
      keys.push({key: key, value: value[key]});
    }
    //console.log("Keys"+keys);
    return keys;
  }
}

似乎您的一项服务正在期望将一个值解析,但不能得到它,也许尝试使参数通过可选。

相关内容

最新更新