2017-02-22 6 views
0

Meine App funktioniert gut, wenn ich einen npm-Start mache. Aber wenn Sie versuchen, mit Prod - npm Build Build: prodFehler beim Ausführen von npm run build: prod von meiner Angular2-App

Es ist ein seltsamer Fehler in einer der kompilierten ts Dateien werfen. Ich verstehe nicht warum.

Bitte helfen

Die Komponentendatei der js-Datei.

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}]); 
    } 


} 

Die Zeile Fehler in der ts-Datei. Coudnt die ganze js einfügen, wie es

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); 
    } 

Der Fehler in der Konsole sehr groß ist, wenn

[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. 

Rohr

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

const currVal_4_0_0: beliebig = valUnwrapper.unwrap (import3.castByValue (this._pipe_keys_0_0, ( this.parentView) ._ pipe_keys_0.transform) (this.parentView.context.competitionTeams)); // das ist die Fehlerzeile Können Sie bitte die Pipe, die Sie für diesen Code hinzugefügt haben, die Fehlerzeile verweist auf pipe_keys –

+0

@RahulSingh hinzugefügt Pipes zum Code –

Antwort

0

Gebäude scheint wie eine Ihrer Dienstleistungen einen Wert zu erwarten geparst werden, aber es nicht bekommen, vielleicht versuchen, den Parameter optional übergeben zu lassen.

+0

@ tan639 Ich habe dich nicht bekommen. Wenn dies der Fall ist, wie läuft die App, wenn npm gestartet wird, nur wenn ich es versuche und es erstelle, gibt es mir diesen Fehler –

+0

Wie erfahren wir was? –

+0

vielleicht wäre dies ein sicherer Ansatz 'ngOnInit() { this.competitionId = this.route.snapshot.params [ 'id']; if (this.competitionId) this.getTeams (this.competitionId); sonst this.getTeams(); } getTeams (COMPUTER_ID: string) { .... ' – tan369

Verwandte Themen