Hola estoy intentando imprirmir el get por pantalla pero me sale este error:
ERROR TypeError: Cannot read property 'played' of undefined
import { Component } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Component({
selector: 'app-tab1',
templateUrl: 'tab1.page.html',
styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
matches: any;
headers: HttpHeaders;
constructor(private http: HttpClient) {
this.headers = new HttpHeaders({
})
this.http.get('api/competitions',{headers: this.headers
}).subscribe(data => {
this.matches = data;
console.log(this.matches);
});
}
}
<ion-content>
<ul *ngFor="let match of matches.played;">
<li>{{match}}</li>
</ul>
</ion-content>