問題はありません。角5タイプエラー:this.tipp.isPersistentは関数ではありません
"Tipp: {
"id":1,
{...}
}
ERROR TypeError: this.tipp.isPersistent is not a function" is shown.
最初のログステートメントが正しく表示されます。次のエラーが表示されたコンソールにログイン中。次のテンプレートスニペットによって呼び出され
@Component({
selector: 'tipp-eingabe',
templateUrl: './tipp-eingabe.component.html',
styleUrls: ['./tipp-eingabe.component.css'],
encapsulation: ViewEncapsulation.None
})
export class TippEingabeComponent implements OnChanges {
@Input() tipp: Tipp;
constructor() {
}
ngOnChanges(changes) {
console.log("Tipp: " + JSON.stringify(this.tipp));
console.log("Tipp-isPersistent: " + this.tipp.isPersistent());
}
}
export class Tipp {
id: number;
spieler: Spieler;
spiel: Spiel;
tippErgebnis: Spielstand;
aenderungsDatum: Date;
public isPersistent(): boolean {
return true;
};
}
は:
<div class="panel panel-default">
<div class="panel panel-body">
<div *ngFor="let spiel of spiele">
<div *ngIf="!isMatchCollapsed(spiel.id)">
<div *ngFor="let tipp of spiel.tipps" class="tippLine">
<tipp-eingabe [tipp]="tipp"></tipp-eingabe>
</div>
</div>
</div>
</div>
</div>
は動作しません:コンパイラの失敗:「プロパティ 『をisPersistent』タイプに存在しません 『TippEingabeComponent』 – user1350889