当我开始使用npm时,我的应用程序运行正常。 但是当尝试使用prod构建时 - 运行构建: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] compiled\src\app\table\table.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;
}
}
答案 0 :(得分:0)
似乎你的一个服务期望一个值被解析但没有得到它,也许试着让参数传递成可选的。